Changeset 235
- Timestamp:
- 02/28/06 22:55:26
- Files:
-
- trunk/calendar3/bldfiles/globalDefs.xml (modified) (1 diff)
- trunk/calendar3/build.xml (modified) (5 diffs)
- trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Event.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/properties/hibernate.properties (modified) (20 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/HibSession.java (modified) (3 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (1 diff)
- trunk/calendar3/dumprestore/build.xml (modified) (2 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java (modified) (21 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EventRule.java (modified) (1 diff)
- trunk/calendar3/lib/jdbc (added)
- trunk/calendar3/lib/jdbc/README (added)
- trunk/calendar3/test/resources/log4j.xml (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/bldfiles/globalDefs.xml
r161 r235 64 64 <property name="cal.default.db" location="${calendar.dir}/db" /> 65 65 <property name="org.bedework.default.lib" location="${calendar.dir}/lib" /> 66 <property name="org.bedework.jdbc.lib" location="${org.bedework.default.lib}/jdbc" /> 66 67 <property name="html.dir" location="${calendar.dir}/html" /> 67 68 trunk/calendar3/build.xml
r223 r235 11 11 12 12 To facilitate this the build process is driven by a set of properties 13 in appsuite/clones.13 in config/configs. 14 14 15 15 You shouldn't need to modify base files or applications. Instead, … … 666 666 --> 667 667 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 668 675 <path id="schema.cp"> 669 <!-- 670 <fileset dir="${org.bedework.default.lib}"> 676 <fileset dir="${org.bedework.jdbc.lib}"> 671 677 <include name="**/*.jar"/> 672 678 </fileset> 673 -->674 <!--675 <fileset dir="${org.bedework.temp.jars}">676 <include name="*.jar"/>677 </fileset>678 -->679 679 <fileset dir="${hibernate.jars.dir}"> 680 680 <include name="**/*.jar"/> … … 691 691 <pathelement location="${org.bedework.core.base}/resources"/> 692 692 <pathelement location="${schema.run.resources}"/> 693 <pathelement location="${schema.run.resources}/hbms"/> 693 694 <pathelement location="${schema.run.resources}/hibernate.properties"/> 694 695 <!-- … … 698 699 --> 699 700 </path> 701 702 <copy todir="${schema.run.resources}/hbms" 703 file="${org.bedework.core.base}/resources/properties/hibernate.cfg.xml" /> 700 704 701 705 <property name="cp" refid="schema.cp" /> … … 715 719 drop="no" 716 720 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"> 721 723 </schemaexport> 722 724 </target> trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml
r48 r235 75 75 </many-to-one> 76 76 77 <property name="trigger" column="trigger " type="text"/>77 <property name="trigger" column="trigger_rfctime" type="text"/> 78 78 79 79 <property name="triggerStart" type="true_false"> … … 82 82 83 83 <property name="duration" column="duration" type="text"/> 84 <property name="repeat" column="repe at" type="integer" />84 <property name="repeat" column="repetitions" type="integer" /> 85 85 <property name="attach" column="attach" type="text"/> 86 86 trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml
r223 r235 41 41 <!-- I wanted to specify unique="true" on this but mysql complains. 42 42 --> 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" 44 45 index="calpath" lazy="false" /> 45 46 trunk/calendar3/calCore/resources/hbms/Event.hbm.xml
r223 r235 82 82 class="org.bedework.calfacade.BwOrganizer" 83 83 column="organizerid" 84 cascade="all,delete-orphan"85 84 unique="true" 86 85 not-null="false" /> trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml
r223 r235 87 87 class="org.bedework.calfacade.BwOrganizer" 88 88 column="organizerid" 89 cascade="all,delete-orphan"90 89 unique="true"/> 91 90 … … 201 200 202 201 <many-to-one name="target" 203 class="org.bedework.calfacade.BwEventObj" lazy=" true" >202 class="org.bedework.calfacade.BwEventObj" lazy="proxy" > 204 203 <column name="targetid" /> 205 204 </many-to-one> 206 205 207 206 <many-to-one name="master" 208 class="org.bedework.calfacade.BwEventObj" lazy=" true" >207 class="org.bedework.calfacade.BwEventObj" lazy="proxy" > 209 208 <column name="masterid" /> 210 209 </many-to-one> trunk/calendar3/calCore/resources/properties/hibernate.cfg.xml
r18 r235 24 24 <mapping resource="AuthUserPrefs.hbm.xml"/> 25 25 <mapping resource="Calendar.hbm.xml"/> 26 <mapping resource="Organizer.hbm.xml"/> 26 27 <mapping resource="Event.hbm.xml"/> 27 28 <mapping resource="EventAnnotation.hbm.xml"/> … … 29 30 <mapping resource="Category.hbm.xml"/> 30 31 <mapping resource="Location.hbm.xml"/> 31 <mapping resource="Organizer.hbm.xml"/>32 32 <mapping resource="Preferences.hbm.xml"/> 33 33 <mapping resource="RecurrenceInstance.hbm.xml"/> trunk/calendar3/calCore/resources/properties/hibernate.properties
r128 r235 34 34 #hibernate.connection.url jdbc:hsqldb:. 35 35 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 42 44 #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 44 56 45 57 ## PostgreSQL 46 58 47 #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect59 #hibernate.dialect org.hibernate.dialect.PostgreSQLDialect 48 60 #hibernate.connection.driver_class org.postgresql.Driver 49 61 #hibernate.connection.url jdbc:postgresql:template1 50 62 #hibernate.connection.username pg 51 63 #hibernate.connection.password 52 #hibernate.query.substitutions yes 'Y', no 'N'53 64 54 65 55 66 ## DB2 56 67 57 #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect68 #hibernate.dialect org.hibernate.dialect.DB2Dialect 58 69 #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver 59 70 #hibernate.connection.url jdbc:db2:test … … 61 72 #hibernate.connection.password db2 62 73 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 63 81 64 82 ## DB2/400 65 83 66 #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect84 #hibernate.dialect org.hibernate.dialect.DB2400Dialect 67 85 #hibernate.connection.username user 68 86 #hibernate.connection.password password … … 77 95 78 96 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 86 102 #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 97 104 98 105 99 106 ## Sybase 100 107 101 #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect108 #hibernate.dialect org.hibernate.dialect.SybaseDialect 102 109 #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver 103 110 #hibernate.connection.username sa 104 111 #hibernate.connection.password sasasa 105 #hibernate.connection. rl jdbc:sybase:Tds:co3061835-a:5000/tempdb112 #hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb 106 113 107 114 108 115 ## Mckoi SQL 109 116 110 #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect117 #hibernate.dialect org.hibernate.dialect.MckoiDialect 111 118 #hibernate.connection.driver_class com.mckoi.JDBCDriver 112 119 #hibernate.connection.url jdbc:mckoi:/// 113 #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0 0/db.conf120 #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf 114 121 #hibernate.connection.username admin 115 122 #hibernate.connection.password nimda … … 118 125 ## SAP DB 119 126 120 #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect127 #hibernate.dialect org.hibernate.dialect.SAPDBDialect 121 128 #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB 122 129 #hibernate.connection.url jdbc:sapdb://localhost/TST … … 128 135 ## MS SQL Server 129 136 130 #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect137 #hibernate.dialect org.hibernate.dialect.SQLServerDialect 131 138 #hibernate.connection.username sa 132 139 #hibernate.connection.password sa … … 148 155 #hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor 149 156 150 ## jTDS ( not supported!)157 ## jTDS (since version 0.9) 151 158 #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 154 160 155 161 ## Interbase 156 162 157 #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect163 #hibernate.dialect org.hibernate.dialect.InterbaseDialect 158 164 #hibernate.connection.username sysdba 159 165 #hibernate.connection.password masterkey … … 174 180 ## Pointbase 175 181 176 #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect182 #hibernate.dialect org.hibernate.dialect.PointbaseDialect 177 183 #hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver 178 184 #hibernate.connection.url jdbc:pointbase:embedded:sample … … 181 187 182 188 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 183 205 184 206 ################################# … … 204 226 205 227 206 ###################################207 ### Apache DBCP Connection Pool ###208 ###################################209 210 ## connection pool211 212 #hibernate.dbcp.maxActive 100213 #hibernate.dbcp.whenExhaustedAction 1214 #hibernate.dbcp.maxWait 120000215 #hibernate.dbcp.maxIdle 10216 217 ## prepared statement cache218 219 #hibernate.dbcp.ps.maxActive 100220 #hibernate.dbcp.ps.whenExhaustedAction 1221 #hibernate.dbcp.ps.maxWait 120000222 #hibernate.dbcp.ps.maxIdle 10223 224 ## optional query to validate pooled connections:225 226 #hibernate.dbcp.validationQuery select 1 from dual227 #hibernate.dbcp.testOnBorrow true228 #hibernate.dbcp.testOnReturn false229 230 231 232 228 ############################## 233 229 ### Proxool Connection Pool### … … 244 240 #hibernate.proxool.properties proxool.properties 245 241 246 ## Or, alternatively, all of these247 ## Standard configuration properties of Proxool248 249 #hibernate.proxool.house-keeping-sleep-time 30000250 #hibernate.proxool.house-keeping-test-sql251 #hibernate.proxool.maximum-connection-count 4252 #hibernate.proxool.maximum-connection-lifetime 4253 #hibernate.proxool.simultaneous-build-throttle 2254 #hibernate.proxool.maximum-active-time 500255 #hibernate.proxool.minimum-connection-count 2256 #hibernate.proxool.fatal-sql-exception257 #hibernate.proxool.prototype-count258 #hibernate.proxool.statistics259 #hibernate.proxool.recently-started-threshold260 #hibernate.proxool.overload-without-refusal-lifetime261 262 242 263 243 … … 268 248 ## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics) 269 249 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 275 254 276 255 … … 280 259 ####################### 281 260 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 282 272 ## the Transaction API abstracts application code from the underlying JTA or JDBC transactions 283 273 … … 297 287 ## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager 298 288 299 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup300 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup301 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup302 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup303 #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup304 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 s 305 295 306 296 … … 313 303 hibernate.show_sql false 314 304 305 ## format SQL in log and console 306 307 hibernate.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 315 319 316 320 ## auto schema export … … 319 323 #hibernate.hbm2ddl.auto create 320 324 #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 341 hibernate.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 ##################### 322 362 323 363 ## specify a JDBC isolation level … … 326 366 327 367 368 ## enable JDBC autocommit (not recommended!) 369 370 #hibernate.connection.autocommit true 371 372 328 373 ## set the JDBC fetch size 329 374 … … 333 378 ## set the maximum JDBC 2 batch size (a nonzero value enables batching) 334 379 380 #hibernate.jdbc.batch_size 5 335 381 hibernate.jdbc.batch_size 0 336 382 337 383 384 ## enable batch updates even for versioned data 385 386 hibernate.jdbc.batch_versioned_data true 387 338 388 ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default) 339 389 … … 351 401 352 402 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 376 418 377 419 … … 386 428 387 429 430 ## set a prefix for cache region names 431 432 hibernate.cache.region_prefix calendardb 433 434 435 ## disable the second-level cache 436 437 #hibernate.cache.use_second_level_cache false 438 439 388 440 ## enable the query cache 389 441 390 442 hibernate.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 391 447 392 448 … … 403 459 404 460 461 ## choose a custom query cache implementation 462 463 #hibernate.cache.query_cache_factory 464 465 405 466 406 467 ############ trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/HibSession.java
r128 r235 771 771 } 772 772 773 /* * Save a new object with the given id. This should only be used for773 /* * Save a new object with the given id. This should only be used for 774 774 * restoring the db from a save or for assigned keys. 775 775 * … … 777 777 * @param id 778 778 * @throws CalFacadeException 779 * /779 * / 780 780 public void save(Object obj, Serializable id) throws CalFacadeException { 781 781 if (exc != null) { … … 789 789 handleException(t); 790 790 } 791 } 791 }*/ 792 792 793 793 /** Delete an object trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r212 r235 1540 1540 } 1541 1541 1542 if (internal.getChildren().size() == 0) { 1543 if (debug) { 1544 trace("No children for internal calendar"); 1545 } 1546 1547 return ts; 1548 } 1549 1542 1550 ts.addAll(postProcess(getCal().getEvents(internal, filter, 1543 1551 startDate, endDate, trunk/calendar3/dumprestore/build.xml
r171 r235 65 65 </path> 66 66 67 <property name="org.bedework.restore.jdbcdriver.jar"68 value="${appserver.jdbcdriver.jar}" />69 70 67 <path id="lib.restore.class.path"> 71 68 <fileset dir="${org.bedework.temp.jars}"> … … 85 82 </fileset> 86 83 87 <pathelement location="${org.bedework.restore.jdbcdriver.jar}" /> 84 <!-- jdbc drivers --> 85 <fileset dir="${org.bedework.jdbc.lib}"> 86 <include name="*.jar"/> 87 </fileset> 88 88 89 89 <!-- add any properties we might want --> trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java
r218 r235 55 55 56 56 57 import org.bedework.calcore.hibernate.HibSession;58 57 import org.bedework.calfacade.BwAlarm; 59 58 import org.bedework.calfacade.BwCalendar; … … 85 84 86 85 import org.apache.log4j.Logger; 87 import org.hibernate. FlushMode;86 import org.hibernate.Query; 88 87 import org.hibernate.SessionFactory; 88 import org.hibernate.Session; 89 import org.hibernate.StatelessSession; 89 90 import org.hibernate.cfg.Configuration; 90 91 … … 99 100 private RestoreGlobals globals; 100 101 101 private HibSession sess;102 //private HibSession sess; 102 103 private SessionFactory sessFactory; 104 105 106 private Session hibSess; 107 private StatelessSession sess; 108 109 private int adminGroupId = 1; 103 110 104 111 private transient Logger log; … … 322 329 openSess(); 323 330 324 s ess.save(o);331 save(o); 325 332 326 333 closeSess(); … … 334 341 openSess(); 335 342 336 sess.save(o, new Integer(o.getId())); 343 //sess.save(o, new Integer(o.getId())); 344 save(o); 337 345 338 346 closeSess(); … … 351 359 openSess(); 352 360 353 s ess.save(o);361 save(o); 354 362 355 363 closeSess(); … … 359 367 openSess(); 360 368 361 s ess.save(o);369 save(o); 362 370 363 371 closeSess(); … … 372 380 if (globals.from2p3px) { 373 381 // 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); 378 387 379 388 log.debug("Saved admin group " + o); … … 395 404 log.debug("About to save " + entry); 396 405 397 s ess.save(entry);406 save(entry); 398 407 399 408 closeSess(); … … 405 414 */ 406 415 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(); 412 425 } 413 426 … … 416 429 */ 417 430 public void restoreEvent(BwEvent o) throws Throwable { 418 open Sess();419 420 sess.save(o, new Integer(o.getId()));421 422 close Sess();431 openHibSess(); 432 433 hibSave(o); 434 435 closeHibSess(); 423 436 } 424 437 … … 427 440 */ 428 441 public void update(BwEvent o) throws Throwable { 429 open Sess();430 431 sess.saveOrUpdate(o);432 433 close Sess();442 openHibSess(); 443 444 hibSess.update(o); 445 446 closeHibSess(); 434 447 } 435 448 … … 440 453 openSess(); 441 454 442 s ess.save(o, new Integer(o.getId()));455 save(o); 443 456 444 457 closeSess(); … … 456 469 sb.append(" ent where ent.address=:address and ent.owner=:owner"); 457 470 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(); 463 476 464 477 if (i == null) { 465 478 // no entry with that key 466 479 467 s ess.save(o, new Integer(o.getId()));480 save(o); 468 481 } 469 482 … … 481 494 sb.append(" ent where ent.name=:name and ent.owner=:owner"); 482 495 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(); 488 501 489 502 if (i == null) { 490 503 // no entry with that key 491 504 492 s ess.save(o, new Integer(o.getId()));505 save(o); 493 506 } 494 507 … … 499 512 500 513 public void restoreOrganizer(BwOrganizer o) throws Throwable { 501 open Sess();502 503 sess.save(o, new Integer(o.getId()));504 505 close Sess();514 openHibSess(); 515 516 hibSave(o); 517 518 closeHibSess(); 506 519 } 507 520 508 521 public void restoreFilter(BwFilter o) throws Throwable { 509 open Sess();510 511 sess.save(o, new Integer(o.getId()));512 513 close Sess();522 openHibSess(); 523 524 hibSave(o); 525 526 closeHibSess(); 514 527 } 515 528 516 529 public void restoreUserPrefs(BwPreferences o) throws Throwable { 517 open Sess();530 openHibSess(); 518 531 519 532 /* Unset the subscription id - hibernate cascades cause an error … … 537 550 } 538 551 539 sess.save(o, new Integer(o.getId()));540 541 close Sess();552 hibSave(o); 553 554 closeHibSess(); 542 555 } 543 556 544 557 public void restoreAlarm(BwAlarm o) throws Throwable { 545 open Sess();546 547 sess.save(o, new Integer(o.getId()));548 549 close Sess();558 openHibSess(); 559 560 hibSave(o); 561 562 closeHibSess(); 550 563 } 551 564 … … 553 566 openSess(); 554 567 555 sess. saveOrUpdate(user);568 sess.update(user); 556 569 557 570 closeSess(); … … 561 574 openSess(); 562 575 563 s ess.save(o);576 save(o); 564 577 565 578 closeSess(); … … 696 709 private synchronized void openSess() throws Throwable { 697 710 if (sess == null) { 698 sess = new HibSession(sessFactory, log); 699 sess.setFlushMode(FlushMode.COMMIT); 700 } else { 701 sess.reconnect(); 711 sess = sessFactory.openStatelessSession(); 702 712 } 703 713 sess.beginTransaction(); 704 714 } 705 715 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 706 738 private synchronized void closeSess() throws Throwable { 707 sess.commit();739 // sess.commit(); 708 740 try { 709 741 if (sess != null) { … … 718 750 } 719 751 } 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 } 720 760 721 761 /* Start a (possibly long-running) transaction. In the web environment trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/rules/EventRule.java
r50 r235 92 92 globals.events++; 93 93 94 if (globals.debug) { 95 trace("Restore event # " + globals.events); 96 } 97 94 98 fixSharableEntity(entity, "Event"); 95 99 trunk/calendar3/test/resources/log4j.xml
r2 r235 88 88 --> 89 89 90 <!-- Hide all the hibernate stuff - below are some finer categories -->90 <!-- Hide all the hibernate stuff - below are some finer categories 91 91 <category name="org.hibernate"> 92 92 <priority value="INFO"/> … … 108 108 <priority value="INFO"/> 109 109 </category> 110 111 <!-- Set washington categories --> 112 <category name="edu.washington"> 113 <priority value="DEBUG"/> 114 </category> 110 --> 115 111 116 112 <!-- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
r207 r235 374 374 375 375 if (calId < 0) { 376 form.getErr().emit("org.bedework.client.error.missing subscriptionid");376 form.getErr().emit("org.bedework.client.error.missingcalendarid"); 377 377 return null; 378 378 }
