-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: many-to-one and saveOrUpdate on child objects
PostPosted: Thu Oct 02, 2003 5:34 pm 
Newbie

Joined: Thu Oct 02, 2003 5:12 pm
Posts: 1
I have read the doc and the forum and am looking for a little help. I have three classes BookshelfItem, MemeberProfile, and BookDetail. On all three I want to specify a key for the id within the program. I have specified the relationship as <many-to-one> and cascade='all' for both child classes.

BookshelfItem --n-----1-->MemberProfile
BookshelfItem --n-----1-->BookDetail

Out of the gate when I called session.save(BookshelfItem) the only thing saved was the BookshelfItem, the MemberProfile and BookDetail objects were not saved. I turned on debugging and what is see is that an insert is called on BookshelfItem and update is called on the two child objects. I did not expect this since I called session.save(...) instead of session.saveOrUpdate(...). I saw where I can set the unsaved-value on the child classes but this forces me to hadle either the save() or update() case manually on the child objects - which I would rather not do. Is this the expected behavior - should not the save() operation be cascaded to the child objects as save() instead of saveOrUpdate()?

Thanks

Following are the details:

===============
hibernate-mapping>
<class name="lab.beans.BookshelfItem" table="memberBookshelf" >
<id name="bookshelfItemId" type="java.lang.String" column="bookshelfId">
<generator class="assigned"/>
</id>
<many-to-one name="bookDetail" column="bookId" cascade="all"/>
<many-to-one name="owner" column="memberId" cascade="all"/>
<many-to-one name="borrower" column="loanedId" />
</class>
================
<hibernate-mapping>
<class name="lab.beans.BookDetail" table="bookdetail" >
<id name="bookId" type="java.lang.String" column="bookId">
<generator class="assigned"/>
</id>
<property name="isbn" unique="true" not-null="true"/>
<property name="title" />
<property name="author" />
<property name="publisher" />
<property name="keywords" />
<property name="copyrightYear" />
</class>
================
<hibernate-mapping>
<class name="lab.beans.MemberProfile" table="memberProfile" >
<id name="memberId" type="java.lang.String" column="memberId">
<generator class="assigned"/>
</id>
<property name="userId"/>
<property name="name" />
<property name="email" />
<property name="phone" />
<property name="location" />
<property name="mailstop" />
<property name="userPswd" />

</class>
==================================
private void storeBookshelfItem() {
Session session = null;
Transaction tx = null;
try {

Configuration cfg = new Configuration();
cfg.configure();
SessionFactory sf = cfg.buildSessionFactory();
session = sf.openSession();
tx = session.beginTransaction();

BookDetail bd = new BookDetail("isbn1234", "Hibernate Lab1");
bd.setBookId("bookId-1111");
MemberProfile mp = new MemberProfile();
mp.setMemberId("member-1111");
mp.setUserId("someUserId");
mp.setName("Some Name");
BookshelfItem bsi = new BookshelfItem();
bsi.setBookshelfItemId("itemId-1111");
bsi.setBookDetail(bd);
bsi.setOwner(mp);
session.save(bsi);
session.flush();
tx.commit();
System.out.println("New Bookshelf Item Saved");
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session != null) {
try {
session.close();
} catch (Exception ignore) {}
}
}
}

==================================
15:43:18,405 INFO Environment:403 - Hibernate 2.0.3
15:43:18,426 INFO Environment:432 - hibernate.properties not found
15:43:18,446 INFO Environment:452 - using CGLIB reflection optimizer
15:43:18,456 INFO Environment:462 - JVM proxy support: true
15:43:18,456 INFO Configuration:703 - Configuration resource: /hibernate.cfg.xml
15:43:19,717 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath under net/sf/hibernate/
15:43:19,767 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath
15:43:19,948 DEBUG Configuration:689 - hibernate.connection.driver_class=com.mysql.jdbc.Driver
15:43:19,948 DEBUG Configuration:689 - hibernate.connection.url=jdbc:mysql://localhost/openLibrary
15:43:19,948 DEBUG Configuration:689 - hibernate.connection.username=jefri
15:43:19,958 DEBUG Configuration:689 - hibernate.connection.password=jefri
15:43:19,958 DEBUG Configuration:689 - dialect=net.sf.hibernate.dialect.MySQLDialect
15:43:19,968 DEBUG Configuration:689 - show_sql=true
15:43:19,968 DEBUG Configuration:689 - use_outer_join=true
15:43:19,968 DEBUG Configuration:689 - jta.UserTransaction=
/UserTransaction
15:43:19,978 DEBUG Configuration:836 - null<-org.dom4j.tree.DefaultAttribute@a46701 [Attribute: name resource value "memberProfile.hbm.xml"]
15:43:19,978 INFO Configuration:270 - Mapping resource: memberProfile.hbm.xml
15:43:20,078 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
15:43:20,098 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
15:43:20,418 INFO Binder:178 - Mapping class: lab.beans.MemberProfile -> memberProfile
15:43:20,659 DEBUG Binder:394 - Mapped property: memberId -> memberId, type: string
15:43:20,709 DEBUG Binder:394 - Mapped property: userId -> userId, type: string
15:43:20,709 DEBUG Binder:394 - Mapped property: name -> name, type: string
15:43:20,719 DEBUG Binder:394 - Mapped property: email -> email, type: string
15:43:20,719 DEBUG Binder:394 - Mapped property: phone -> phone, type: string
15:43:20,719 DEBUG Binder:394 - Mapped property: location -> location, type: string
15:43:20,769 DEBUG Binder:394 - Mapped property: mailstop -> mailstop, type: string
15:43:20,769 DEBUG Binder:394 - Mapped property: userPswd -> userPswd, type: string
15:43:20,769 DEBUG Configuration:836 - null<-org.dom4j.tree.DefaultAttribute@1431340 [Attribute: name resource value "bookDetail.hbm.xml"]
15:43:20,769 INFO Configuration:270 - Mapping resource: bookDetail.hbm.xml
15:43:20,809 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
15:43:20,869 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
15:43:20,969 INFO Binder:178 - Mapping class: lab.beans.BookDetail -> bookdetail
15:43:20,969 DEBUG Binder:394 - Mapped property: bookId -> bookId, type: string
15:43:20,979 DEBUG Binder:394 - Mapped property: isbn -> isbn, type: string
15:43:20,979 DEBUG Binder:394 - Mapped property: title -> title, type: string
15:43:20,979 DEBUG Binder:394 - Mapped property: author -> author, type: string
15:43:21,069 DEBUG Binder:394 - Mapped property: publisher -> publisher, type: string
15:43:21,069 DEBUG Binder:394 - Mapped property: keywords -> keywords, type: string
15:43:21,069 DEBUG Binder:394 - Mapped property: copyrightYear -> copyrightYear, type: string
15:43:21,079 DEBUG Configuration:836 - null<-org.dom4j.tree.DefaultAttribute@f1bb78 [Attribute: name resource value "bookshelfItem.hbm.xml"]
15:43:21,079 INFO Configuration:270 - Mapping resource: bookshelfItem.hbm.xml
15:43:21,179 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
15:43:21,189 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
15:43:21,270 INFO Binder:178 - Mapping class: lab.beans.BookshelfItem -> memberBookshelf
15:43:21,270 DEBUG Binder:394 - Mapped property: bookshelfItemId -> bookshelfId, type: string
15:43:21,290 DEBUG Binder:394 - Mapped property: bookDetail -> bookId, type: lab.beans.BookDetail
15:43:21,290 DEBUG Binder:394 - Mapped property: owner -> memberId, type: lab.beans.MemberProfile
15:43:21,290 DEBUG Binder:394 - Mapped property: borrower -> loanedId, type: lab.beans.MemberProfile
15:43:21,300 INFO Configuration:885 - Configured SessionFactory: null
15:43:21,300 DEBUG Configuration:886 - properties: {hibernate.connection.password=jefri, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=C:\j2sdk1.4.2_01\jre\bin, java.vm.version=1.4.2_01-b06, hibernate.connection.username=jefri, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, use_outer_join=true, user.country=US, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\netbeans\bin, java.runtime.version=1.4.2_01-b06, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\j2sdk1.4.2_01\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\e0067399\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, jta.UserTransaction=
/UserTransaction
, java.library.path=C:\j2sdk1.4.2_01\jre\bin;.;C:\WINNT\system32;C:\WINNT;V:\PVCS\VM\win32\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\e0067399, user.timezone=America/Chicago, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=e0067399, java.class.path=C:\Documents and Settings\e0067399\.netbeans\3.5\system;C:\Documents and Settings\e0067399\.netbeans\3.5\system;C:\netbeans\system;C:\netbeans\modules\ext\AbsoluteLayout.jar;C:\netbeans\modules\autoload\ext\servlet-2.3.jar;C:\netbeans\lib\ext\xml-apis-1.0b2.jar;C:\netbeans\beans\TimerBean.jar;C:\labs\hibernateLabs;C:\labs\hibernateLabs\lib\c3p0.jar;C:\labs\hibernateLabs\lib\cglib-asm.jar;C:\labs\hibernateLabs\lib\commons-beanutils.jar;C:\labs\hibernateLabs\lib\commons-collections.jar;C:\labs\hibernateLabs\lib\commons-dbcp.jar;C:\labs\hibernateLabs\lib\commons-lang.jar;C:\labs\hibernateLabs\lib\commons-logging.jar;C:\labs\hibernateLabs\lib\commons-pool.jar;C:\labs\hibernateLabs\lib\dom4j.jar;C:\labs\hibernateLabs\lib\hibernate2.jar;C:\labs\hibernateLabs\lib\jcs.jar;C:\labs\hibernateLabs\lib\jdbc2_0-stdext.jar;C:\labs\hibernateLabs\lib\jta.jar;C:\labs\hibernateLabs\lib\optional.jar;C:\labs\hibernateLabs\lib\proxool.jar;C:\labs\hibernateLabs\lib\xalan.jar;C:\labs\hibernateLabs\lib\xerces.jar;C:\labs\hibernateLabs\lib\xml-apis.jar;C:\labs\hibernateLabs\lab1\classes;C:\labs\hibernateLabs\lab1\build;C:\labs\hibernateLabs\lab1\conf;C:\labs\hibernateLabs\lab1\src;C:\labs\hibernateLabs\lib\mysql-connector-java-3.0.8-stable-bin.jar;C:\labs\hibernateLabs\lib\log4j-1.2.8.jar;, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\j2sdk1.4.2_01\jre, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost/openLibrary, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_01, java.ext.dirs=C:\j2sdk1.4.2_01\jre\lib\ext, sun.boot.class.path=C:\j2sdk1.4.2_01\jre\lib\rt.jar;C:\j2sdk1.4.2_01\jre\lib\i18n.jar;C:\j2sdk1.4.2_01\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_01\jre\lib\jsse.jar;C:\j2sdk1.4.2_01\jre\lib\jce.jar;C:\j2sdk1.4.2_01\jre\lib\charsets.jar;C:\j2sdk1.4.2_01\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jta.UserTransaction=
/UserTransaction
, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, hibernate.use_outer_join=true, dialect=net.sf.hibernate.dialect.MySQLDialect, sun.cpu.isalist=pentium i486 i386}
15:43:21,320 INFO Configuration:492 - processing one-to-many association mappings
15:43:21,320 INFO Configuration:503 - processing foreign key constraints
15:43:21,330 DEBUG Configuration:513 - resolving reference to class: lab.beans.BookDetail
15:43:21,330 DEBUG Configuration:513 - resolving reference to class: lab.beans.MemberProfile
15:43:21,330 DEBUG Configuration:513 - resolving reference to class: lab.beans.MemberProfile
15:43:21,860 INFO SessionFactoryImpl:132 - building session factory
15:43:21,870 DEBUG SessionFactoryImpl:134 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=jefri, sun.boot.library.path=C:\j2sdk1.4.2_01\jre\bin, java.vm.version=1.4.2_01-b06, hibernate.connection.username=jefri, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 4, use_outer_join=true, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\netbeans\bin, java.runtime.version=1.4.2_01-b06, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\j2sdk1.4.2_01\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\e0067399\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, jta.UserTransaction=
/UserTransaction
, java.library.path=C:\j2sdk1.4.2_01\jre\bin;.;C:\WINNT\system32;C:\WINNT;V:\PVCS\VM\win32\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\ENGLISH, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\e0067399, user.timezone=America/Chicago, java.awt.printerjob=sun.awt.windows.WPrinterJob, java.specification.version=1.4, file.encoding=Cp1252, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, java.class.path=C:\Documents and Settings\e0067399\.netbeans\3.5\system;C:\Documents and Settings\e0067399\.netbeans\3.5\system;C:\netbeans\system;C:\netbeans\modules\ext\AbsoluteLayout.jar;C:\netbeans\modules\autoload\ext\servlet-2.3.jar;C:\netbeans\lib\ext\xml-apis-1.0b2.jar;C:\netbeans\beans\TimerBean.jar;C:\labs\hibernateLabs;C:\labs\hibernateLabs\lib\c3p0.jar;C:\labs\hibernateLabs\lib\cglib-asm.jar;C:\labs\hibernateLabs\lib\commons-beanutils.jar;C:\labs\hibernateLabs\lib\commons-collections.jar;C:\labs\hibernateLabs\lib\commons-dbcp.jar;C:\labs\hibernateLabs\lib\commons-lang.jar;C:\labs\hibernateLabs\lib\commons-logging.jar;C:\labs\hibernateLabs\lib\commons-pool.jar;C:\labs\hibernateLabs\lib\dom4j.jar;C:\labs\hibernateLabs\lib\hibernate2.jar;C:\labs\hibernateLabs\lib\jcs.jar;C:\labs\hibernateLabs\lib\jdbc2_0-stdext.jar;C:\labs\hibernateLabs\lib\jta.jar;C:\labs\hibernateLabs\lib\optional.jar;C:\labs\hibernateLabs\lib\proxool.jar;C:\labs\hibernateLabs\lib\xalan.jar;C:\labs\hibernateLabs\lib\xerces.jar;C:\labs\hibernateLabs\lib\xml-apis.jar;C:\labs\hibernateLabs\lab1\classes;C:\labs\hibernateLabs\lab1\build;C:\labs\hibernateLabs\lab1\conf;C:\labs\hibernateLabs\lab1\src;C:\labs\hibernateLabs\lib\mysql-connector-java-3.0.8-stable-bin.jar;C:\labs\hibernateLabs\lib\log4j-1.2.8.jar;, user.name=e0067399, hibernate.show_sql=true, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\j2sdk1.4.2_01\jre, hibernate.connection.url=jdbc:mysql://localhost/openLibrary, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, hibernate.cglib.use_reflection_optimizer=true, java.version=1.4.2_01, java.ext.dirs=C:\j2sdk1.4.2_01\jre\lib\ext, sun.boot.class.path=C:\j2sdk1.4.2_01\jre\lib\rt.jar;C:\j2sdk1.4.2_01\jre\lib\i18n.jar;C:\j2sdk1.4.2_01\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_01\jre\lib\jsse.jar;C:\j2sdk1.4.2_01\jre\lib\jce.jar;C:\j2sdk1.4.2_01\jre\lib\charsets.jar;C:\j2sdk1.4.2_01\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jta.UserTransaction=
/UserTransaction
, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, hibernate.use_outer_join=true, sun.cpu.isalist=pentium i486 i386, dialect=net.sf.hibernate.dialect.MySQLDialect}
15:43:21,921 INFO Dialect:83 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
15:43:21,941 INFO DriverManagerConnectionProvider:41 - Hibernate connection pool size: 20
15:43:21,961 INFO DriverManagerConnectionProvider:70 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/openLibrary
15:43:21,961 INFO DriverManagerConnectionProvider:71 - connection properties: {user=jefri, password=jefri}
15:43:22,011 INFO SessionFactoryImpl:162 - Use outer join fetching: true
15:43:22,011 DEBUG DriverManagerConnectionProvider:77 - total checked-out connections: 0
15:43:22,011 DEBUG DriverManagerConnectionProvider:90 - opening new JDBC connection
15:43:22,561 DEBUG DriverManagerConnectionProvider:103 - created connection to: jdbc:mysql://localhost/openLibrary, Isolation Level: 4
15:43:22,571 DEBUG DriverManagerConnectionProvider:117 - returning connection to pool, pool size: 1
15:43:22,571 INFO SessionFactoryImpl:185 - Use scrollable result sets: true
15:43:22,571 INFO SessionFactoryImpl:186 - JDBC 2 max batch size: 15
15:43:22,592 INFO SessionFactoryImpl:194 - echoing all SQL to stdout
15:43:23,613 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
15:43:23,623 DEBUG SessionFactoryObjectFactory:76 - registered: 402880e5f7fe8a5800f7fe8a60530000 (unnamed)
15:43:23,643 INFO SessionFactoryObjectFactory:82 - no JDNI name configured
15:43:23,643 INFO SessionFactoryImpl:269 - Query language substitutions: {}
15:43:23,643 DEBUG SessionFactoryImpl:281 - instantiated session factory
15:43:23,763 DEBUG SessionImpl:413 - opened session
15:43:23,773 DEBUG JDBCTransaction:36 - begin
15:43:23,783 DEBUG DriverManagerConnectionProvider:77 - total checked-out connections: 0
15:43:23,783 DEBUG DriverManagerConnectionProvider:83 - using pooled JDBC connection, pool size: 0
15:43:23,793 DEBUG SessionImpl:656 - saving [lab.beans.BookshelfItem#itemId-1111]
15:43:23,793 DEBUG Cascades:336 - processing cascades for: lab.beans.BookshelfItem
15:43:23,803 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,803 DEBUG Cascades:237 - unsaved-value strategy NULL
15:43:23,803 DEBUG SessionImpl:1205 - saveOrUpdate() previously saved instance with id: bookId-1111
15:43:23,803 DEBUG SessionImpl:1270 - updating [lab.beans.BookDetail#bookId-1111]
15:43:23,803 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,803 DEBUG Cascades:237 - unsaved-value strategy NULL
15:43:23,803 DEBUG SessionImpl:1205 - saveOrUpdate() previously saved instance with id: member-1111
15:43:23,803 DEBUG SessionImpl:1270 - updating [lab.beans.MemberProfile#member-1111]
15:43:23,803 DEBUG Cascades:344 - done processing cascades for: lab.beans.BookshelfItem
15:43:23,823 DEBUG Cascades:336 - processing cascades for: lab.beans.BookshelfItem
15:43:23,823 DEBUG Cascades:344 - done processing cascades for: lab.beans.BookshelfItem
15:43:23,823 DEBUG SessionImpl:2011 - flushing session
15:43:23,833 DEBUG Cascades:336 - processing cascades for: lab.beans.BookshelfItem
15:43:23,833 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,833 DEBUG SessionImpl:1183 - saveOrUpdate() persistent instance
15:43:23,833 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,833 DEBUG SessionImpl:1183 - saveOrUpdate() persistent instance
15:43:23,833 DEBUG Cascades:344 - done processing cascades for: lab.beans.BookshelfItem
15:43:23,833 DEBUG SessionImpl:2113 - Flushing entities and processing referenced collections
15:43:23,833 DEBUG SessionImpl:2209 - Updating entity: [lab.beans.BookDetail#bookId-1111]
15:43:23,843 DEBUG SessionImpl:2209 - Updating entity: [lab.beans.MemberProfile#member-1111]
15:43:23,843 DEBUG SessionImpl:2397 - Processing unreferenced collections
15:43:23,843 DEBUG SessionImpl:2408 - Scheduling collection removes/(re)creates/updates
15:43:23,843 DEBUG SessionImpl:2023 - Flushed: 1 insertions, 2 updates, 0 deletions to 3 objects
15:43:23,843 DEBUG SessionImpl:2028 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
15:43:23,843 DEBUG SessionImpl:2058 - executing flush
15:43:23,843 DEBUG EntityPersister:464 - Inserting entity: lab.beans.BookshelfItem#itemId-1111
15:43:23,853 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets
15:43:23,853 DEBUG SessionFactoryImpl:526 - prepared statement get: insert into memberBookshelf (bookId, memberId, loanedId, bookshelfId) values (?, ?, ?, ?)
Hibernate: insert into memberBookshelf (bookId, memberId, loanedId, bookshelfId) values (?, ?, ?, ?)
15:43:23,853 DEBUG SessionFactoryImpl:536 - preparing statement
15:43:23,903 DEBUG EntityPersister:366 - Dehydrating entity: lab.beans.BookshelfItem#itemId-1111
15:43:23,903 DEBUG BatcherImpl:24 - Adding to batch
15:43:23,903 DEBUG BatcherImpl:46 - Executing batch size: 1
15:43:23,913 DEBUG BatcherImpl:173 - done closing: 0 open PreparedStatements, 0 open ResultSets
15:43:23,913 DEBUG SessionFactoryImpl:554 - closing statement
15:43:23,913 DEBUG EntityPersister:617 - Updating entity: lab.beans.BookDetail#bookId-1111
15:43:23,913 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets
15:43:23,913 DEBUG SessionFactoryImpl:526 - prepared statement get: update bookdetail set isbn=?, title=?, author=?, publisher=?, keywords=?, copyrightYear=? where bookId=?
Hibernate: update bookdetail set isbn=?, title=?, author=?, publisher=?, keywords=?, copyrightYear=? where bookId=?
15:43:23,913 DEBUG SessionFactoryImpl:536 - preparing statement
15:43:23,923 DEBUG EntityPersister:366 - Dehydrating entity: lab.beans.BookDetail#bookId-1111
15:43:23,923 DEBUG BatcherImpl:24 - Adding to batch
15:43:23,923 DEBUG EntityPersister:617 - Updating entity: lab.beans.MemberProfile#member-1111
15:43:23,923 DEBUG BatcherImpl:46 - Executing batch size: 1
15:43:23,923 DEBUG BatcherImpl:173 - done closing: 0 open PreparedStatements, 0 open ResultSets
15:43:23,933 DEBUG SessionFactoryImpl:554 - closing statement
15:43:23,933 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets
15:43:23,933 DEBUG SessionFactoryImpl:526 - prepared statement get: update memberProfile set userId=?, name=?, email=?, phone=?, location=?, mailstop=?, userPswd=? where memberId=?
Hibernate: update memberProfile set userId=?, name=?, email=?, phone=?, location=?, mailstop=?, userPswd=? where memberId=?
15:43:23,933 DEBUG SessionFactoryImpl:536 - preparing statement
15:43:23,933 DEBUG EntityPersister:366 - Dehydrating entity: lab.beans.MemberProfile#member-1111
15:43:23,933 DEBUG BatcherImpl:24 - Adding to batch
15:43:23,933 DEBUG BatcherImpl:46 - Executing batch size: 1
15:43:23,943 DEBUG BatcherImpl:173 - done closing: 0 open PreparedStatements, 0 open ResultSets
15:43:23,943 DEBUG SessionFactoryImpl:554 - closing statement
15:43:23,943 DEBUG SessionImpl:2428 - post flush
15:43:23,943 DEBUG JDBCTransaction:54 - commit
15:43:23,943 DEBUG SessionImpl:2011 - flushing session
15:43:23,943 DEBUG Cascades:336 - processing cascades for: lab.beans.BookshelfItem
15:43:23,953 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,953 DEBUG SessionImpl:1183 - saveOrUpdate() persistent instance
15:43:23,953 DEBUG Cascades:87 - cascading to saveOrUpdate()
15:43:23,953 DEBUG SessionImpl:1183 - saveOrUpdate() persistent instance
15:43:23,953 DEBUG Cascades:344 - done processing cascades for: lab.beans.BookshelfItem
15:43:23,953 DEBUG SessionImpl:2113 - Flushing entities and processing referenced collections
15:43:23,963 DEBUG SessionImpl:2397 - Processing unreferenced collections
15:43:23,963 DEBUG SessionImpl:2408 - Scheduling collection removes/(re)creates/updates
15:43:23,963 DEBUG SessionImpl:2023 - Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
15:43:23,963 DEBUG SessionImpl:2028 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
15:43:23,963 DEBUG SessionImpl:2058 - executing flush
15:43:23,963 DEBUG SessionImpl:2428 - post flush
15:43:23,973 DEBUG SessionImpl:447 - transaction completion
New Bookshelf Item Saved
15:43:23,973 DEBUG SessionImpl:435 - closing session
15:43:23,973 DEBUG SessionImpl:2930 - disconnecting session
15:43:23,973 DEBUG DriverManagerConnectionProvider:117 - returning connection to pool, pool size: 1
15:43:23,973 DEBUG SessionImpl:447 - transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The solution is to use an Interceptor.isUnsaved() callback. Please refer to the "Parent/Child Relationship" doc.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.