cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] Cocoon215TOC OJBWithJDO NewbieGuideToOJB Mon Apr 19 14:00:04 2004
Date Mon, 19 Apr 2004 12:00:05 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=Cocoon215TOC , version: 46 on Sun Apr 19 11:01:54
2004 by 213.48.13.39

- * From the CLI
+ * From the CLI/from Apache Ant
+ [[This whole section should be removed - it relates to as yet unwritten code - UV]


Page: http://wiki.cocoondev.org/Wiki.jsp?page=OJBWithJDO , version: 8 on Sun Apr 19 11:18:38
2004 by MikeAhlers

- # PersistentBroker
+ # PersistentBroker [Newbie guide to OJB]
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=NewbieGuideToOJB , version: 4 on Sun Apr 19
11:33:34 2004 by MikeAhlers

- public Object loadObject(Object obj, String key, Object value) {
?               ^^^^

+ public Object getObject(Object obj, String key, Object value) {
?               ^^^

-         System.out.println("Error in loadObject: " + e.getMessage());
?                                      ^^^^

+         System.out.println("Error in getObject: " + e.getMessage());
?                                      ^^^

+ {{{
+ public Object setObject(Object obj) {
+     PersistenceBroker broker = null;
+     try {
+         if(obj == null)
+             return obj;
+         broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+         broker.beginTransaction();
+         broker.store(obj);						// Store the object (make persistent)
+         broker.commitTransaction();
+         // At this point the object is updated with an auto-generated key, if any.
+     } catch (Exception e) {
+         System.out.println("Error in setObject: " + e.getMessage());
+         broker.abortTransaction();					// Roll back
+     } finally {
+         if(broker != null)
+             broker.close();						// Release broker instance to the broker-pool
+     }
+     return obj;
+ }
+ }}}
+ 



Mime
View raw message