Changeset 235

Show
Ignore:
Timestamp:
02/28/06 22:55:26
Author:
douglm
Message:

Further changes to get calendar working with mysql (5)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/bldfiles/globalDefs.xml

    r161 r235  
    6464    <property name="cal.default.db" location="${calendar.dir}/db" /> 
    6565    <property name="org.bedework.default.lib" location="${calendar.dir}/lib" /> 
     66    <property name="org.bedework.jdbc.lib" location="${org.bedework.default.lib}/jdbc" /> 
    6667    <property name="html.dir" location="${calendar.dir}/html" /> 
    6768 
  • trunk/calendar3/build.xml

    r223 r235  
    1111 
    1212     To facilitate this the build process is driven by a set of properties 
    13      in appsuite/clones. 
     13     in config/configs. 
    1414 
    1515     You shouldn't need to modify base files or applications. Instead, 
     
    666666              --> 
    667667 
     668    <mkdir dir="${schema.run.resources}/hbms" /> 
     669    <copy todir="${schema.run.resources}/hbms" > 
     670      <fileset dir="${org.bedework.core.base}/resources/hbms"> 
     671        <include name="*.hbm.xml"/> 
     672      </fileset> 
     673    </copy> 
     674 
    668675    <path id="schema.cp"> 
    669       <!-- 
    670       <fileset dir="${org.bedework.default.lib}"> 
     676      <fileset dir="${org.bedework.jdbc.lib}"> 
    671677         <include name="**/*.jar"/> 
    672678      </fileset> 
    673       --> 
    674       <!-- 
    675       <fileset dir="${org.bedework.temp.jars}"> 
    676          <include name="*.jar"/> 
    677       </fileset> 
    678       --> 
    679679      <fileset dir="${hibernate.jars.dir}"> 
    680680         <include name="**/*.jar"/> 
     
    691691      <pathelement location="${org.bedework.core.base}/resources"/> 
    692692      <pathelement location="${schema.run.resources}"/> 
     693      <pathelement location="${schema.run.resources}/hbms"/> 
    693694      <pathelement location="${schema.run.resources}/hibernate.properties"/> 
    694695      <!-- 
     
    698699      --> 
    699700    </path> 
     701 
     702    <copy todir="${schema.run.resources}/hbms" 
     703          file="${org.bedework.core.base}/resources/properties/hibernate.cfg.xml" /> 
    700704 
    701705    <property name="cp" refid="schema.cp" /> 
     
    715719                  drop="no" 
    716720                  delimiter=";" 
    717                   output="schema-export.sql"> 
    718                   <fileset dir="${org.bedework.core.base}/resources/hbms"> 
    719                     <include name="*.hbm.xml"/> 
    720                   </fileset> 
     721                  output="schema-export.sql" 
     722                  config="${schema.run.resources}/hbms/hibernate.cfg.xml"> 
    721723    </schemaexport> 
    722724  </target> 
  • trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml

    r48 r235  
    7575    </many-to-one> 
    7676 
    77     <property name="trigger" column="trigger" type="text"/> 
     77    <property name="trigger" column="trigger_rfctime" type="text"/> 
    7878 
    7979    <property name="triggerStart" type="true_false"> 
     
    8282 
    8383    <property name="duration" column="duration" type="text"/> 
    84     <property name="repeat" column="repeat" type="integer" /> 
     84    <property name="repeat" column="repetitions" type="integer" /> 
    8585    <property name="attach" column="attach" type="text"/> 
    8686 
  • trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml

    r223 r235  
    4141    <!-- I wanted to specify unique="true" on this but mysql complains. 
    4242      --> 
    43     <property name="path" column="path" type="text" not-null="true" 
     43    <property name="path" column="path" type="string" length="1000" 
     44              not-null="true" 
    4445              index="calpath" lazy="false" /> 
    4546 
  • trunk/calendar3/calCore/resources/hbms/Event.hbm.xml

    r223 r235  
    8282                 class="org.bedework.calfacade.BwOrganizer" 
    8383                 column="organizerid" 
    84                  cascade="all,delete-orphan" 
    8584                 unique="true" 
    8685                 not-null="false" /> 
  • trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml

    r223 r235  
    8787                 class="org.bedework.calfacade.BwOrganizer" 
    8888                 column="organizerid" 
    89                  cascade="all,delete-orphan" 
    9089                 unique="true"/> 
    9190 
     
    201200 
    202201    <many-to-one name="target" 
    203                  class="org.bedework.calfacade.BwEventObj" lazy="true" > 
     202                 class="org.bedework.calfacade.BwEventObj" lazy="proxy" > 
    204203      <column name="targetid" /> 
    205204    </many-to-one> 
    206205 
    207206    <many-to-one name="master" 
    208                  class="org.bedework.calfacade.BwEventObj" lazy="true" > 
     207                 class="org.bedework.calfacade.BwEventObj" lazy="proxy" > 
    209208      <column name="masterid" /> 
    210209    </many-to-one> 
  • trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml

    r18 r235  
    2424    <mapping resource="AuthUserPrefs.hbm.xml"/> 
    2525    <mapping resource="Calendar.hbm.xml"/> 
     26    <mapping resource="Organizer.hbm.xml"/> 
    2627    <mapping resource="Event.hbm.xml"/> 
    2728    <mapping resource="EventAnnotation.hbm.xml"/> 
     
    2930    <mapping resource="Category.hbm.xml"/> 
    3031    <mapping resource="Location.hbm.xml"/> 
    31     <mapping resource="Organizer.hbm.xml"/> 
    3232    <mapping resource="Preferences.hbm.xml"/> 
    3333    <mapping resource="RecurrenceInstance.hbm.xml"/> 
  • trunk/calendar3/calCore/resources/properties/hibernate.properties

    r128 r235  
    3434#hibernate.connection.url jdbc:hsqldb:. 
    3535 
    36  
    37 ## Informix 
    38  
    39 #hibernate.dialect net.sf.hibernate.dialect.InformixDialect 
    40 #hibernate.connection.driver_class org.hsqldb.jdbcDriver 
    41 #hibernate.connection.username sa 
     36## MySQL 
     37 
     38#hibernate.dialect org.hibernate.dialect.MySQLDialect 
     39#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect 
     40#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect 
     41#hibernate.connection.driver_class com.mysql.jdbc.Driver 
     42#hibernate.connection.url jdbc:mysql:///test 
     43#hibernate.connection.username gavin 
    4244#hibernate.connection.password 
    43 #hibernate.connection.url jdbc:hsqldb:hsql://localhost:8887 
     45 
     46 
     47## Oracle 
     48 
     49#hibernate.dialect org.hibernate.dialect.OracleDialect 
     50#hibernate.dialect org.hibernate.dialect.Oracle9Dialect 
     51#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver 
     52#hibernate.connection.username ora 
     53#hibernate.connection.password ora 
     54#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl 
     55 
    4456 
    4557## PostgreSQL 
    4658 
    47 #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect 
     59#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect 
    4860#hibernate.connection.driver_class org.postgresql.Driver 
    4961#hibernate.connection.url jdbc:postgresql:template1 
    5062#hibernate.connection.username pg 
    5163#hibernate.connection.password 
    52 #hibernate.query.substitutions yes 'Y', no 'N' 
    5364 
    5465 
    5566## DB2 
    5667 
    57 #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect 
     68#hibernate.dialect org.hibernate.dialect.DB2Dialect 
    5869#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver 
    5970#hibernate.connection.url jdbc:db2:test 
     
    6172#hibernate.connection.password db2 
    6273 
     74## TimesTen (not supported yet) 
     75 
     76#hibernate.dialect org.hibernate.dialect.TimesTenDialect 
     77#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver 
     78#hibernate.connection.url jdbc:timesten:direct:test 
     79#hibernate.connection.username 
     80#hibernate.connection.password 
    6381 
    6482## DB2/400 
    6583 
    66 #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect 
     84#hibernate.dialect org.hibernate.dialect.DB2400Dialect 
    6785#hibernate.connection.username user 
    6886#hibernate.connection.password password 
     
    7795 
    7896 
    79 ## MySQL 
    80  
    81 #hibernate.dialect net.sf.hibernate.dialect.MySQLDialect 
    82 #hibernate.connection.driver_class org.gjt.mm.mysql.Driver 
    83 #hibernate.connection.driver_class com.mysql.jdbc.Driver 
    84 #hibernate.connection.url jdbc:mysql:///test 
    85 #hibernate.connection.username root 
     97## Derby (Not supported!) 
     98 
     99#hibernate.dialect org.hibernate.dialect.DerbyDialect 
     100#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver 
     101#hibernate.connection.username 
    86102#hibernate.connection.password 
    87  
    88  
    89 ## Oracle 
    90  
    91 #hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect 
    92 #hibernate.dialect net.sf.hibernate.dialect.OracleDialect 
    93 #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver 
    94 #hibernate.connection.username ora 
    95 #hibernate.connection.password ora 
    96 #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test 
     103#hibernate.connection.url jdbc:derby:/test;create=true 
    97104 
    98105 
    99106## Sybase 
    100107 
    101 #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect 
     108#hibernate.dialect org.hibernate.dialect.SybaseDialect 
    102109#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver 
    103110#hibernate.connection.username sa 
    104111#hibernate.connection.password sasasa 
    105 #hibernate.connection.rl jdbc:sybase:Tds:co3061835-a:5000/tempdb 
     112#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb 
    106113 
    107114 
    108115## Mckoi SQL 
    109116 
    110 #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect 
     117#hibernate.dialect org.hibernate.dialect.MckoiDialect 
    111118#hibernate.connection.driver_class com.mckoi.JDBCDriver 
    112119#hibernate.connection.url jdbc:mckoi:/// 
    113 #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf 
     120#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf 
    114121#hibernate.connection.username admin 
    115122#hibernate.connection.password nimda 
     
    118125## SAP DB 
    119126 
    120 #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect 
     127#hibernate.dialect org.hibernate.dialect.SAPDBDialect 
    121128#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB 
    122129#hibernate.connection.url jdbc:sapdb://localhost/TST 
     
    128135## MS SQL Server 
    129136 
    130 #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect 
     137#hibernate.dialect org.hibernate.dialect.SQLServerDialect 
    131138#hibernate.connection.username sa 
    132139#hibernate.connection.password sa 
     
    148155#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor 
    149156 
    150 ## jTDS (not supported!
     157## jTDS (since version 0.9
    151158#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver 
    152 #hibernate.connection.url jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor 
    153 #hibernate.jdbc.use_scrollable_resultset false 
     159#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test 
    154160 
    155161## Interbase 
    156162 
    157 #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect 
     163#hibernate.dialect org.hibernate.dialect.InterbaseDialect 
    158164#hibernate.connection.username sysdba 
    159165#hibernate.connection.password masterkey 
     
    174180## Pointbase 
    175181 
    176 #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect 
     182#hibernate.dialect org.hibernate.dialect.PointbaseDialect 
    177183#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver 
    178184#hibernate.connection.url jdbc:pointbase:embedded:sample 
     
    181187 
    182188 
     189## Ingres 
     190 
     191#hibernate.dialect org.hibernate.dialect.IngresDialect 
     192#hibernate.connection.driver_class ca.edbc.jdbc.EdbcDriver 
     193#hibernate.connection.url jdbc:edbc://localhost:II7/database 
     194#hibernate.connection.username user 
     195#hibernate.connection.password password 
     196 
     197 
     198## Mimer SQL 
     199 
     200#hibernate.dialect org.hibernate.dialect.MimerSQLDialect 
     201#hibernate.connection.driver_class com.mimer.jdbc.Driver 
     202#hibernate.connection.url jdbc:mimer:multi1 
     203#hibernate.connection.username hibernate 
     204#hibernate.connection.password hibernate 
    183205 
    184206################################# 
     
    204226 
    205227 
    206 ################################### 
    207 ### Apache DBCP Connection Pool ### 
    208 ################################### 
    209  
    210 ## connection pool 
    211  
    212 #hibernate.dbcp.maxActive 100 
    213 #hibernate.dbcp.whenExhaustedAction 1 
    214 #hibernate.dbcp.maxWait 120000 
    215 #hibernate.dbcp.maxIdle 10 
    216  
    217 ## prepared statement cache 
    218  
    219 #hibernate.dbcp.ps.maxActive 100 
    220 #hibernate.dbcp.ps.whenExhaustedAction 1 
    221 #hibernate.dbcp.ps.maxWait 120000 
    222 #hibernate.dbcp.ps.maxIdle 10 
    223  
    224 ## optional query to validate pooled connections: 
    225  
    226 #hibernate.dbcp.validationQuery select 1 from dual 
    227 #hibernate.dbcp.testOnBorrow true 
    228 #hibernate.dbcp.testOnReturn false 
    229  
    230  
    231  
    232228############################## 
    233229### Proxool Connection Pool### 
     
    244240#hibernate.proxool.properties proxool.properties 
    245241 
    246 ## Or, alternatively, all of these 
    247 ## Standard configuration properties of Proxool 
    248  
    249 #hibernate.proxool.house-keeping-sleep-time 30000 
    250 #hibernate.proxool.house-keeping-test-sql 
    251 #hibernate.proxool.maximum-connection-count 4 
    252 #hibernate.proxool.maximum-connection-lifetime 4 
    253 #hibernate.proxool.simultaneous-build-throttle 2 
    254 #hibernate.proxool.maximum-active-time 500 
    255 #hibernate.proxool.minimum-connection-count 2 
    256 #hibernate.proxool.fatal-sql-exception 
    257 #hibernate.proxool.prototype-count 
    258 #hibernate.proxool.statistics 
    259 #hibernate.proxool.recently-started-threshold 
    260 #hibernate.proxool.overload-without-refusal-lifetime 
    261  
    262242 
    263243 
     
    268248## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics) 
    269249 
    270 #hibernate.connection.provider_class net.sf.hibernate.connection.DriverManagerConnectionProvider 
    271 #hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider 
    272 #hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider 
    273 #hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider 
    274 #hibernate.connection.provider_class net.sf.hibernate.connection.ProxoolConnectionProvider 
     250#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider 
     251#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider 
     252#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider 
     253#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider 
    275254 
    276255 
     
    280259####################### 
    281260 
     261## Enable automatic flush during the JTA beforeCompletion() callback 
     262## (This setting is relevant with or without the Transaction API) 
     263 
     264#hibernate.transaction.flush_before_completion 
     265 
     266 
     267## Enable automatic session close at the end of transaction 
     268## (This setting is relevant with or without the Transaction API) 
     269 
     270#hibernate.transaction.auto_close_session 
     271 
    282272## the Transaction API abstracts application code from the underlying JTA or JDBC transactions 
    283273 
     
    297287## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager 
    298288 
    299 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup 
    300 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup 
    301 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup 
    302 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup 
    303 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup 
    304  
     289#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup 
     290#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup 
     291#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup 
     292#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup 
     293#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup 
     294
    305295 
    306296 
     
    313303hibernate.show_sql false 
    314304 
     305## format SQL in log and console 
     306 
     307hibernate.format_sql true 
     308 
     309 
     310## add comments to the generated SQL 
     311 
     312#hibernate.use_sql_comments true 
     313 
     314 
     315## generate statistics 
     316 
     317#hibernate.generate_statistics true 
     318 
    315319 
    316320## auto schema export 
     
    319323#hibernate.hbm2ddl.auto create 
    320324#hibernate.hbm2ddl.auto update 
    321  
     325#hibernate.hbm2ddl.auto validate 
     326 
     327 
     328## specify a default schema and catalog for unqualified tablenames 
     329 
     330#hibernate.default_schema test 
     331#hibernate.default_catalog test 
     332 
     333 
     334## enable ordering of SQL UPDATEs by primary key 
     335 
     336#hibernate.order_updates true 
     337 
     338 
     339## set the maximum depth of the outer join fetch tree 
     340 
     341hibernate.max_fetch_depth 1 
     342 
     343## set the default batch size for batch fetching 
     344 
     345#hibernate.default_batch_fetch_size 8 
     346 
     347 
     348## rollback generated identifier values of deleted entities to default values 
     349 
     350#hibernate.use_identifer_rollback true 
     351 
     352 
     353## enable CGLIB reflection optimizer (enabled by default) 
     354 
     355#hibernate.cglib.use_reflection_optimizer false 
     356 
     357 
     358 
     359##################### 
     360### JDBC Settings ### 
     361##################### 
    322362 
    323363## specify a JDBC isolation level 
     
    326366 
    327367 
     368## enable JDBC autocommit (not recommended!) 
     369 
     370#hibernate.connection.autocommit true 
     371 
     372 
    328373## set the JDBC fetch size 
    329374 
     
    333378## set the maximum JDBC 2 batch size (a nonzero value enables batching) 
    334379 
     380#hibernate.jdbc.batch_size 5 
    335381hibernate.jdbc.batch_size 0 
    336382 
    337383 
     384## enable batch updates even for versioned data 
     385 
     386hibernate.jdbc.batch_versioned_data true 
     387 
    338388## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default) 
    339389 
     
    351401 
    352402 
    353 ## specify a default schema for unqualified tablenames 
    354  
    355 #hibernate.default_schema test 
    356  
    357  
    358 ## use a custom stylesheet for XML generation (if not specified, hibernate-default.xslt will be used) 
    359  
    360 #hibernate.xml.output_stylesheet C:/Hibernate/net/sf/hibernate/hibernate-default.xslt 
    361  
    362  
    363 ## enable outerjoin fetching (specifying a Dialect will cause Hibernate to use sensible default) 
    364  
    365 #hibernate.use_outer_join false 
    366  
    367  
    368 ## set the maximum depth of the outer join fetch tree 
    369  
    370 hibernate.max_fetch_depth 1 
    371  
    372  
    373 ## enable CGLIB reflection optimizer (enabled by default) 
    374  
    375 #hibernate.cglib.use_reflection_optimizer false 
     403 
     404## choose a custom JDBC batcher 
     405 
     406# hibernate.jdbc.factory_class 
     407 
     408 
     409## enable JDBC result set column alias caching 
     410## (minor performance enhancement for broken JDBC drivers) 
     411 
     412# hibernate.jdbc.wrap_result_sets 
     413 
     414 
     415## choose a custom SQL exception converter 
     416 
     417#hibernate.jdbc.sql_exception_converter 
    376418 
    377419 
     
    386428 
    387429 
     430## set a prefix for cache region names 
     431 
     432hibernate.cache.region_prefix calendardb 
     433 
     434 
     435## disable the second-level cache 
     436 
     437#hibernate.cache.use_second_level_cache false 
     438 
     439 
    388440## enable the query cache 
    389441 
    390442hibernate.cache.use_query_cache true 
     443 
     444## store the second-level cache entries in a more human-friendly format 
     445 
     446#hibernate.cache.use_structured_entries true 
    391447 
    392448 
     
    403459 
    404460 
     461## choose a custom query cache implementation 
     462 
     463#hibernate.cache.query_cache_factory 
     464 
     465 
    405466 
    406467############ 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/HibSession.java

    r128 r235  
    771771  } 
    772772 
    773   /** Save a new object with the given id. This should only be used for 
     773  /* * Save a new object with the given id. This should only be used for 
    774774   * restoring the db from a save or for assigned keys. 
    775775   * 
     
    777777   * @param id 
    778778   * @throws CalFacadeException 
    779    *
     779   *
    780780  public void save(Object obj, Serializable id) throws CalFacadeException { 
    781781    if (exc != null) { 
     
    789789      handleException(t); 
    790790    } 
    791   } 
     791  }*/ 
    792792 
    793793  /** Delete an object 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r212 r235  
    15401540    } 
    15411541     
     1542    if (internal.getChildren().size() == 0) { 
     1543      if (debug) { 
     1544        trace("No children for internal calendar"); 
     1545      } 
     1546       
     1547      return ts; 
     1548    } 
     1549     
    15421550    ts.addAll(postProcess(getCal().getEvents(internal, filter, 
    15431551                          startDate, endDate, 
  • trunk/calendar3/dumprestore/build.xml

    r171 r235  
    6565    </path> 
    6666 
    67     <property name="org.bedework.restore.jdbcdriver.jar" 
    68               value="${appserver.jdbcdriver.jar}" /> 
    69  
    7067    <path id="lib.restore.class.path"> 
    7168      <fileset dir="${org.bedework.temp.jars}"> 
     
    8582      </fileset> 
    8683 
    87       <pathelement location="${org.bedework.restore.jdbcdriver.jar}" /> 
     84      <!-- jdbc drivers --> 
     85      <fileset dir="${org.bedework.jdbc.lib}"> 
     86        <include name="*.jar"/> 
     87      </fileset> 
    8888 
    8989      <!-- add any properties we might want --> 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java

    r218 r235  
    5555 
    5656 
    57 import org.bedework.calcore.hibernate.HibSession; 
    5857import org.bedework.calfacade.BwAlarm; 
    5958import org.bedework.calfacade.BwCalendar; 
     
    8584 
    8685import org.apache.log4j.Logger; 
    87 import org.hibernate.FlushMode
     86import org.hibernate.Query
    8887import org.hibernate.SessionFactory; 
     88import org.hibernate.Session; 
     89import org.hibernate.StatelessSession; 
    8990import org.hibernate.cfg.Configuration; 
    9091 
     
    99100  private RestoreGlobals globals; 
    100101 
    101   private HibSession sess; 
     102  //private HibSession sess; 
    102103  private SessionFactory sessFactory; 
     104   
     105   
     106  private Session hibSess; 
     107  private StatelessSession sess; 
     108   
     109  private int adminGroupId = 1; 
    103110 
    104111  private transient Logger log; 
     
    322329    openSess(); 
    323330 
    324     sess.save(o); 
     331    save(o); 
    325332 
    326333    closeSess(); 
     
    334341      openSess(); 
    335342 
    336       sess.save(o, new Integer(o.getId())); 
     343      //sess.save(o, new Integer(o.getId())); 
     344      save(o); 
    337345 
    338346      closeSess(); 
     
    351359    openSess(); 
    352360 
    353     sess.save(o); 
     361    save(o); 
    354362 
    355363    closeSess(); 
     
    359367    openSess(); 
    360368 
    361     sess.save(o); 
     369    save(o); 
    362370 
    363371    closeSess(); 
     
    372380    if (globals.from2p3px) { 
    373381      // No id assigned 
    374       sess.save(o); 
    375     } else { 
    376       sess.save(o, new Integer(o.getId())); 
    377     } 
     382      o.setId(adminGroupId); 
     383      adminGroupId++; 
     384    } 
     385     
     386    save(o); 
    378387 
    379388    log.debug("Saved admin group " + o); 
     
    395404      log.debug("About to save " + entry); 
    396405 
    397       sess.save(entry); 
     406      save(entry); 
    398407 
    399408      closeSess(); 
     
    405414   */ 
    406415  public void restoreAuthUser(BwAuthUser o) throws Throwable { 
    407     openSess(); 
    408  
    409     sess.save(o); 
    410  
    411     closeSess(); 
     416    openHibSess(); 
     417 
     418//    if (o.getId() <= 0) { 
     419//      o.setId(o.getUser().getId()); 
     420//    } 
     421     
     422    hibSave(o); 
     423 
     424    closeHibSess(); 
    412425  } 
    413426 
     
    416429   */ 
    417430  public void restoreEvent(BwEvent o) throws Throwable { 
    418     openSess(); 
    419  
    420     sess.save(o, new Integer(o.getId())); 
    421  
    422     closeSess(); 
     431    openHibSess(); 
     432 
     433    hibSave(o); 
     434 
     435    closeHibSess(); 
    423436  } 
    424437 
     
    427440   */ 
    428441  public void update(BwEvent o) throws Throwable { 
    429     openSess(); 
    430  
    431     sess.saveOrUpdate(o); 
    432  
    433     closeSess(); 
     442    openHibSess(); 
     443 
     444    hibSess.update(o); 
     445 
     446    closeHibSess(); 
    434447  } 
    435448 
     
    440453    openSess(); 
    441454 
    442     sess.save(o, new Integer(o.getId())); 
     455    save(o); 
    443456 
    444457    closeSess(); 
     
    456469    sb.append(" ent where ent.address=:address and ent.owner=:owner"); 
    457470 
    458     sess.createQuery(sb.toString()); 
    459     sess.setString("address", o.getAddress()); 
    460     sess.setEntity("owner", o.getOwner()); 
    461  
    462     Integer i = (Integer)sess.getUnique(); 
     471    Query q = sess.createQuery(sb.toString()); 
     472    q.setString("address", o.getAddress()); 
     473    q.setEntity("owner", o.getOwner()); 
     474     
     475    Integer i = (Integer)q.uniqueResult(); 
    463476 
    464477    if (i == null) { 
    465478      // no entry with that key 
    466479 
    467       sess.save(o, new Integer(o.getId())); 
     480      save(o); 
    468481    } 
    469482 
     
    481494    sb.append(" ent where ent.name=:name and ent.owner=:owner"); 
    482495 
    483     sess.createQuery(sb.toString()); 
    484     sess.setString("name", o.getName()); 
    485     sess.setEntity("owner", o.getOwner()); 
    486  
    487     Integer i = (Integer)sess.getUnique(); 
     496    Query q = sess.createQuery(sb.toString()); 
     497    q.setString("name", o.getName()); 
     498    q.setEntity("owner", o.getOwner()); 
     499 
     500    Integer i = (Integer)q.uniqueResult(); 
    488501 
    489502    if (i == null) { 
    490503      // no entry with that key 
    491504 
    492       sess.save(o, new Integer(o.getId())); 
     505      save(o); 
    493506    } 
    494507 
     
    499512 
    500513  public void restoreOrganizer(BwOrganizer o) throws Throwable { 
    501     openSess(); 
    502  
    503     sess.save(o, new Integer(o.getId())); 
    504  
    505     closeSess(); 
     514    openHibSess(); 
     515 
     516    hibSave(o); 
     517 
     518    closeHibSess(); 
    506519  } 
    507520 
    508521  public void restoreFilter(BwFilter o) throws Throwable { 
    509     openSess(); 
    510  
    511     sess.save(o, new Integer(o.getId())); 
    512  
    513     closeSess(); 
     522    openHibSess(); 
     523 
     524    hibSave(o); 
     525 
     526    closeHibSess(); 
    514527  } 
    515528 
    516529  public void restoreUserPrefs(BwPreferences o) throws Throwable { 
    517     openSess(); 
     530    openHibSess(); 
    518531 
    519532    /* Unset the subscription id - hibernate cascades cause an error 
     
    537550    } 
    538551 
    539     sess.save(o, new Integer(o.getId())); 
    540  
    541     closeSess(); 
     552    hibSave(o); 
     553 
     554    closeHibSess(); 
    542555  } 
    543556 
    544557  public void restoreAlarm(BwAlarm o) throws Throwable { 
    545     openSess(); 
    546  
    547     sess.save(o, new Integer(o.getId())); 
    548  
    549     closeSess(); 
     558    openHibSess(); 
     559 
     560    hibSave(o); 
     561 
     562    closeHibSess(); 
    550563  } 
    551564 
     
    553566    openSess(); 
    554567 
    555     sess.saveOrUpdate(user); 
     568    sess.update(user); 
    556569 
    557570    closeSess(); 
     
    561574    openSess(); 
    562575 
    563     sess.save(o); 
     576    save(o); 
    564577 
    565578    closeSess(); 
     
    696709  private synchronized void openSess() throws Throwable { 
    697710    if (sess == null) { 
    698       sess = new HibSession(sessFactory, log); 
    699       sess.setFlushMode(FlushMode.COMMIT); 
    700     } else { 
    701       sess.reconnect(); 
     711      sess = sessFactory.openStatelessSession(); 
    702712    } 
    703713    sess.beginTransaction(); 
    704714  } 
    705715 
     716  private synchronized void openHibSess() throws Throwable { 
     717    if (hibSess == null) { 
     718      hibSess = sessFactory.openSession(); 
     719    } 
     720    hibSess.beginTransaction(); 
     721  } 
     722 
     723  private synchronized void closeHibSess() throws Throwable { 
     724    hibSess.getTransaction().commit(); 
     725    try { 
     726      if (hibSess != null) { 
     727        hibSess.close(); 
     728        //hibSess.disconnect(); 
     729      } 
     730   // } catch (Throwable t) { 
     731      // Discard session if we get errors on close. 
     732//      sess = null; 
     733    } finally { 
     734      hibSess = null; 
     735    } 
     736  } 
     737 
    706738  private synchronized void closeSess() throws Throwable { 
    707     sess.commit(); 
     739//    sess.commit(); 
    708740    try { 
    709741      if (sess != null) { 
     
    718750    } 
    719751  } 
     752   
     753  private void hibSave(Object o) throws Throwable { 
     754    hibSess.save(o); 
     755  } 
     756   
     757  private void save(Object o) throws Throwable { 
     758    sess.insert(o); 
     759  } 
    720760 
    721761  /* Start a (possibly long-running) transaction. In the web environment 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EventRule.java

    r50 r235  
    9292    globals.events++; 
    9393 
     94    if (globals.debug) { 
     95      trace("Restore event # " + globals.events); 
     96    } 
     97 
    9498    fixSharableEntity(entity, "Event"); 
    9599 
  • trunk/calendar3/test/resources/log4j.xml

    r2 r235  
    8888 --> 
    8989 
    90    <!-- Hide all the hibernate stuff - below are some finer categories --> 
     90   <!-- Hide all the hibernate stuff - below are some finer categories 
    9191   <category name="org.hibernate"> 
    9292      <priority value="INFO"/> 
     
    108108      <priority value="INFO"/> 
    109109   </category> 
    110  
    111    <!-- Set washington categories --> 
    112    <category name="edu.washington"> 
    113      <priority value="DEBUG"/> 
    114    </category> 
     110    --> 
    115111 
    116112   <!-- 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r207 r235  
    374374 
    375375    if (calId < 0) { 
    376       form.getErr().emit("org.bedework.client.error.missingsubscriptionid"); 
     376      form.getErr().emit("org.bedework.client.error.missingcalendarid"); 
    377377      return null; 
    378378    }