-->
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.  [ 8 posts ] 
Author Message
 Post subject: .delete() question
PostPosted: Wed Dec 10, 2003 10:30 am 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Code:
<class name="A" table="A">
        <id name="id" column="A_ID" type="long">
        ...
        </id>

        <set name="bset" lazy="true" table="A_B" cascade="all">
            <key column="A_ID"/>
            <many-to-many class="B" column="B_ID" />
        </set>
</class>
...
<class name="C" table="C">
        <id name="id" column="C_ID" type="long">
        ...
        </id>

        <set name="aset" lazy="true" table="C_A" cascade="all">
            <key column="C_ID"/>
            <many-to-many class="A" column="A_ID" />
        </set>
</class>


When I delete object of class A Hibernate also cleans up set "A.bset" (the A_B) table but doesn't touch C.aset (C_A) table. Is this normal behaviour or I missed something?

If it is normal, how am I supposed to remove corresponding records from C_A table? Using DB triggers/integrity constraints or there is another way?

Btw, if trigger/constraint is required for C_A, why Hibernate does clean up A_B table?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 10:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Nope. Not normal.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 10:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I should also point out that cascade delete for a many-to-many association is a bit of a questionable concept. What if a particular C is related to many As?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 10:59 am 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Quote:
Nope. Not normal.


does this mean Hibernate should invoke

DELETE FROM C_A WHERE A_ID=?

? What am I missing in mapping then?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 11:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
What am I missing in mapping then?


No idea. The mapping looks fine.

I advise you to use the log.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 12:51 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Tried the same with HB 2.0.3 - same results. Are you sure Hibernate should remove object of class A from C.aset while there is no direct association from A -> C ?

Spend some time looking at log. No clue.

Code:
19:46:39,562  INFO Environment:432 - Hibernate 2.1 rc1
19:46:39,562  INFO Environment:461 - hibernate.properties not found
19:46:39,578  INFO Environment:481 - using CGLIB reflection optimizer
19:46:39,578  INFO Environment:504 - JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
19:46:39,578  INFO Environment:507 - using workaround for JVM bug in java.sql.Timestamp
19:46:39,593  INFO Configuration:824 - configuring from resource: /hibernate.cfg.xml
19:46:39,593  INFO Configuration:796 - Configuration resource: /hibernate.cfg.xml
19:46:40,297 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd in classpath under net/sf/hibernate/
19:46:40,297 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd in classpath
19:46:40,390 DEBUG Configuration:782 - dialect=net.sf.hibernate.dialect.OracleDialect
19:46:40,390 DEBUG Configuration:782 - show_sql=true
19:46:40,390 DEBUG Configuration:782 - use_outer_join=true
19:46:40,390 DEBUG Configuration:782 - jdbc.use_scrollable_resultset=true
19:46:40,390 DEBUG Configuration:782 - hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N'
19:46:40,390 DEBUG Configuration:933 - null<-org.dom4j.tree.DefaultAttribute@74689e [Attribute: name resource value "Mapping.hbm.xml"]
19:46:40,390  INFO Configuration:287 - Mapping resource: Mapping.hbm.xml
19:46:40,406 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
19:46:40,422 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
19:46:40,672  INFO Binder:196 - Mapping class: B -> B
19:46:40,812 DEBUG Binder:418 - Mapped property: id -> B_ID, type: long
19:46:40,828  INFO Binder:196 - Mapping class: A -> A
19:46:40,828 DEBUG Binder:418 - Mapped property: id -> A_ID, type: long
19:46:40,828  INFO Binder:502 - Mapping collection: A.bset -> A_B
19:46:40,844 DEBUG Binder:418 - Mapped property: bset, type: java.util.Set
19:46:40,859  INFO Binder:196 - Mapping class: C -> C
19:46:40,859 DEBUG Binder:418 - Mapped property: id -> C_ID, type: long
19:46:40,859  INFO Binder:502 - Mapping collection: C.aset -> C_A
19:46:40,859 DEBUG Binder:418 - Mapped property: aset, type: java.util.Set
19:46:40,859  INFO Configuration:979 - Configured SessionFactory: null
19:46:40,859 DEBUG Configuration:980 - properties: {jdbc.use_scrollable_resultset=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=C:\Program Files\jdk1.3.1_07\jre\bin, java.vm.version=1.3.1_07-b02, 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, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Documents and Settings\dimas\IdeaProjects\hbtest, java.runtime.version=1.3.1_07-b02, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\dimas\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., java.awt.fonts=, os.name=Windows XP, java.library.path=C:\Program Files\jdk1.3.1_07\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\temp\iogear\;C:\Program Files\Adobe\Document Server 5.0\bin;C:\Program Files\Adobe\Graphics Server 2.0\bin;C:\Progra~1\Oracle9iDS\bin;C:\Progra~1\Oracle9iDS\jdk\jre\bin;C:\Progra~1\Oracle9iDS\jdk\jre\bin\classic;C:\Progra~1\Oracle9iDS\jdk\jre\bin\classic;C:\Progra~1\Oracle9iDS\jlib;C:\Progra~1\Oracle9iDS\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\SecureCRT;C:\PROGRA~1\SecureFX;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Cygwin\bin;C:\Progra~1\GNU\WinCvs~1.2\;C:\Program Files\Embarcadero\DBA54;C:\Program Files\Embarcadero\Feb2001Shared;C:\Program Files\Oracle9iDS\bin\;C:\Progra~1\apache~1.3-1\bin\, java.specification.name=Java Platform API Specification, java.class.version=47.0, os.version=5.1, hibernate.jdbc.use_scrollable_resultset=true, user.home=C:\Documents and Settings\dimas, user.timezone=Europe/Moscow, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.3, show_sql=true, user.name=dimas, java.class.path=C:\Documents and Settings\dimas\IdeaProjects\hbtest\classes;C:\Program Files\jdk1.3.1_07\jre\lib\i18n.jar;C:\Program Files\jdk1.3.1_07\jre\lib\jaws.jar;C:\Program Files\jdk1.3.1_07\jre\lib\rt.jar;C:\Program Files\jdk1.3.1_07\jre\lib\sunrsasign.jar;C:\Program Files\jdk1.3.1_07\jre\lib\ext\Coroutine4Java.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\commons-collections.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\commons-logging.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\dom4j.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\jta.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\odmg.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\xerces.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\xml-apis.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\oracle.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\log4j-1.2.7.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\ehcache.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\cglib2.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\hibernate2.jar, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\jdk1.3.1_07\jre, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, 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.3.1_07, java.ext.dirs=C:\Program Files\jdk1.3.1_07\jre\lib\ext, sun.boot.class.path=C:\Program Files\jdk1.3.1_07\jre\lib\rt.jar;C:\Program Files\jdk1.3.1_07\jre\lib\i18n.jar;C:\Program Files\jdk1.3.1_07\jre\lib\sunrsasign.jar;C:\Program Files\jdk1.3.1_07\jre\classes, java.vendor=Sun Microsystems Inc., 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, user.region=US, dialect=net.sf.hibernate.dialect.OracleDialect, sun.cpu.isalist=pentium i486 i386}
19:46:40,890  INFO Configuration:565 - processing one-to-many association mappings
19:46:40,890 DEBUG Binder:1279 - Second pass for collection: A.bset
19:46:40,937 DEBUG Binder:1291 - Mapped collection key: A_ID, element: B_ID, type: B
19:46:40,937 DEBUG Binder:1279 - Second pass for collection: C.aset
19:46:40,953 DEBUG Binder:1291 - Mapped collection key: C_ID, element: A_ID, type: A
19:46:40,953  INFO Configuration:574 - processing one-to-one association property references
19:46:40,953  INFO Configuration:599 - processing foreign key constraints
19:46:40,953 DEBUG Configuration:609 - resolving reference to class: A
19:46:40,953 DEBUG Configuration:609 - resolving reference to class: B
19:46:40,953 DEBUG Configuration:609 - resolving reference to class: A
19:46:40,953 DEBUG Configuration:609 - resolving reference to class: C
19:46:41,000  INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.OracleDialect
19:46:41,000  INFO SettingsFactory:62 - Use outer join fetching: true
19:46:41,015  WARN UserSuppliedConnectionProvider:25 - No connection properties specified - the user must supply JDBC connections
19:46:41,015  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
19:46:41,015  INFO SettingsFactory:89 - Use scrollable result sets: true
19:46:41,062  INFO SettingsFactory:90 - JDBC 2 max batch size: 15
19:46:41,062  INFO SettingsFactory:96 - echoing all SQL to stdout
19:46:41,062  INFO SettingsFactory:99 - Query language substitutions: {false=0, no='N', yes='Y', true=1}
19:46:41,062  INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
19:46:41,078  INFO Configuration:1038 - instantiating and configuring caches
19:46:41,484  INFO SessionFactoryImpl:118 - building session factory
19:46:41,484 DEBUG SessionFactoryImpl:124 - instantiating session factory with properties: {jdbc.use_scrollable_resultset=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=C:\Program Files\jdk1.3.1_07\jre\bin, java.vm.version=1.3.1_07-b02, 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, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Documents and Settings\dimas\IdeaProjects\hbtest, java.runtime.version=1.3.1_07-b02, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\dimas\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., java.awt.fonts=, os.name=Windows XP, java.library.path=C:\Program Files\jdk1.3.1_07\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\Program Files\Adobe\Document Server 5.0\bin;C:\Program Files\Adobe\Graphics Server 2.0\bin;C:\Progra~1\Oracle9iDS\bin;C:\Progra~1\Oracle9iDS\jdk\jre\bin;C:\Progra~1\Oracle9iDS\jdk\jre\bin\classic;C:\Progra~1\Oracle9iDS\jdk\jre\bin\classic;C:\Progra~1\Oracle9iDS\jlib;C:\Progra~1\Oracle9iDS\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Cygwin\bin;C:\Progra~1\GNU\WinCvs~1.2\;C:\Program Files\Oracle9iDS\bin\;C:\Progra~1\apache~1.3-1\bin\, java.specification.name=Java Platform API Specification, java.class.version=47.0, os.version=5.1, hibernate.jdbc.use_scrollable_resultset=true, user.home=C:\Documents and Settings\dimas, user.timezone=Europe/Moscow, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.3, show_sql=true, user.name=dimas, java.class.path=C:\Documents and Settings\dimas\IdeaProjects\hbtest\classes;C:\Program Files\jdk1.3.1_07\jre\lib\i18n.jar;C:\Program Files\jdk1.3.1_07\jre\lib\jaws.jar;C:\Program Files\jdk1.3.1_07\jre\lib\rt.jar;C:\Program Files\jdk1.3.1_07\jre\lib\sunrsasign.jar;C:\Program Files\jdk1.3.1_07\jre\lib\ext\Coroutine4Java.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\commons-collections.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\commons-logging.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\dom4j.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\jta.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\odmg.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\xerces.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\xml-apis.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\oracle.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\log4j-1.2.7.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\ehcache.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\cglib2.jar;C:\Documents and Settings\dimas\IdeaProjects\AssetScheduler\lib\hibernate2.jar, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Program Files\jdk1.3.1_07\jre, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, 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.3.1_07, java.ext.dirs=C:\Program Files\jdk1.3.1_07\jre\lib\ext, sun.boot.class.path=C:\Program Files\jdk1.3.1_07\jre\lib\rt.jar;C:\Program Files\jdk1.3.1_07\jre\lib\i18n.jar;C:\Program Files\jdk1.3.1_07\jre\lib\sunrsasign.jar;C:\Program Files\jdk1.3.1_07\jre\classes, java.vendor=Sun Microsystems Inc., 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, user.region=US, dialect=net.sf.hibernate.dialect.OracleDialect, sun.cpu.isalist=pentium i486 i386}
19:46:41,953  WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
19:46:41,953 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
19:46:41,969 DEBUG SessionFactoryObjectFactory:76 - registered: 40288309f961087600f9610879210000 (unnamed)
19:46:41,969  INFO SessionFactoryObjectFactory:82 - no JNDI name configured
19:46:41,969 DEBUG SessionFactoryImpl:190 - instantiated session factory
19:46:42,797 DEBUG SessionImpl:526 - opened session
19:46:42,797 DEBUG SessionImpl:1587 - delete: from A a where a.id=200
19:46:42,812 DEBUG SessionImpl:1455 - find: from A a where a.id=200
19:46:42,828 DEBUG QueryTranslator:150 - compiling query
19:46:42,875 DEBUG SessionImpl:2188 - flushing session
19:46:42,875 DEBUG SessionImpl:2316 - Flushing entities and processing referenced collections
19:46:42,875 DEBUG SessionImpl:2659 - Processing unreferenced collections
19:46:42,875 DEBUG SessionImpl:2673 - Scheduling collection removes/(re)creates/updates
19:46:42,875 DEBUG SessionImpl:2212 - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
19:46:42,875 DEBUG SessionImpl:2217 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
19:46:42,875 DEBUG SessionImpl:1740 - Dont need to execute flush
19:46:42,875 DEBUG QueryTranslator:202 - HQL: from A a where a.id=200
19:46:42,875 DEBUG QueryTranslator:203 - SQL: select a0_.A_ID as A_ID from A a0_ where (a0_.A_ID=200 )
19:46:42,875 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:46:42,875 DEBUG BatcherImpl:226 - prepared statement get: select a0_.A_ID as A_ID from A a0_ where (a0_.A_ID=200 )
Hibernate: select a0_.A_ID as A_ID from A a0_ where (a0_.A_ID=200 )
19:46:42,875 DEBUG BatcherImpl:232 - preparing statement
19:46:42,906 DEBUG Loader:192 - processing result set
19:46:42,922 DEBUG LongType:68 - returning '200' as column: A_ID
19:46:42,922 DEBUG Loader:400 - result row: 200
19:46:42,922 DEBUG Loader:531 - Initializing object from ResultSet: 200
19:46:42,922 DEBUG Loader:600 - Hydrating entity: A#200
19:46:42,937 DEBUG Loader:221 - done processing result set (1 rows)
19:46:42,937 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:46:42,937 DEBUG BatcherImpl:245 - closing statement
19:46:42,937 DEBUG Loader:234 - total objects hydrated: 1
19:46:42,937 DEBUG SessionImpl:2124 - resolving associations for [A#200]
19:46:42,953 DEBUG SessionImpl:3727 - collection not cached
19:46:42,969 DEBUG SessionImpl:2148 - done materializing entity [A#200]
19:46:42,969 DEBUG SessionImpl:2995 - initializing non-lazy collections
19:46:42,969 DEBUG SessionImpl:1097 - deleting a persistent instance
19:46:42,969 DEBUG SessionImpl:1117 - deleting [A#200]
19:46:42,969 DEBUG Cascades:497 - processing cascades for: A
19:46:42,969 DEBUG Cascades:524 - cascading to collection: A.bset
19:46:42,969 DEBUG SessionImpl:3127 - initializing collection [A.bset#200]
19:46:42,969 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:46:42,969 DEBUG BatcherImpl:226 - prepared statement get: select a_b0_.B_ID as B_ID__, a_b0_.A_ID as A_ID__, b1_.B_ID as B_ID0_ from A_B a_b0_, B b1_ where a_b0_.A_ID=? and a_b0_.B_ID=b1_.B_ID
Hibernate: select a_b0_.B_ID as B_ID__, a_b0_.A_ID as A_ID__, b1_.B_ID as B_ID0_ from A_B a_b0_, B b1_ where a_b0_.A_ID=? and a_b0_.B_ID=b1_.B_ID
19:46:42,984 DEBUG BatcherImpl:232 - preparing statement
19:46:42,984 DEBUG LongType:46 - binding '200' to parameter: 1
19:46:42,984 DEBUG Loader:322 - result set contains (possibly empty) collection: [A.bset#200]
19:46:42,984 DEBUG SessionImpl:2897 - uninitialized collection: initializing
19:46:42,984 DEBUG Loader:192 - processing result set
19:46:42,984 DEBUG LongType:68 - returning '1000' as column: B_ID0_
19:46:42,984 DEBUG Loader:400 - result row: 1000
19:46:42,984 DEBUG Loader:531 - Initializing object from ResultSet: 1000
19:46:42,984 DEBUG Loader:600 - Hydrating entity: B#1000
19:46:42,984 DEBUG LongType:68 - returning '200' as column: A_ID__
19:46:42,984 DEBUG Loader:284 - found row of collection: [A.bset#200]
19:46:43,000 DEBUG SessionImpl:2920 - reading row
19:46:43,000 DEBUG LongType:68 - returning '1000' as column: B_ID__
19:46:43,015 DEBUG SessionImpl:1908 - loading [B#1000]
19:46:43,015 DEBUG SessionImpl:2005 - attempting to resolve [B#1000]
19:46:43,015 DEBUG SessionImpl:2021 - resolved object in session cache [B#1000]
19:46:43,015 DEBUG Loader:221 - done processing result set (1 rows)
19:46:43,015 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:46:43,015 DEBUG BatcherImpl:245 - closing statement
19:46:43,015 DEBUG Loader:234 - total objects hydrated: 1
19:46:43,015 DEBUG SessionImpl:2124 - resolving associations for [B#1000]
19:46:43,015 DEBUG SessionImpl:2148 - done materializing entity [B#1000]
19:46:43,015 DEBUG SessionImpl:2956 - 1 collections were found in result set
19:46:43,015 DEBUG SessionImpl:2974 - collection fully initialized: [A.bset#200]
19:46:43,015 DEBUG SessionImpl:2977 - 1 collections initialized
19:46:43,015 DEBUG SessionImpl:2995 - initializing non-lazy collections
19:46:43,031 DEBUG Cascades:60 - cascading to delete()
19:46:43,031 DEBUG SessionImpl:1097 - deleting a persistent instance
19:46:43,031 DEBUG SessionImpl:1117 - deleting [B#1000]
19:46:43,031 DEBUG Cascades:506 - done processing cascades for: A
19:46:43,031 DEBUG Cascades:497 - processing cascades for: A
19:46:43,031 DEBUG Cascades:506 - done processing cascades for: A
19:46:43,031 DEBUG SessionImpl:2188 - flushing session
19:46:43,031 DEBUG SessionImpl:2316 - Flushing entities and processing referenced collections
19:46:43,047 DEBUG SessionImpl:2659 - Processing unreferenced collections
19:46:43,047 DEBUG SessionImpl:2780 - Collection dereferenced: [A.bset#200]
19:46:43,047 DEBUG SessionImpl:2673 - Scheduling collection removes/(re)creates/updates
19:46:43,047 DEBUG SessionImpl:2212 - Flushed: 0 insertions, 0 updates, 2 deletions to 2 objects
19:46:43,047 DEBUG SessionImpl:2217 - Flushed: 0 (re)creations, 0 updates, 1 removals to 1 collections
19:46:43,047 DEBUG Printer:75 - listing entities:
19:46:43,047 DEBUG Printer:82 - B{id=1000}
19:46:43,062 DEBUG Printer:82 - A{bset=[B#1000], id=200}
19:46:43,062 DEBUG SessionImpl:2253 - executing flush
19:46:43,062 DEBUG BasicCollectionPersister:493 - Deleting collection: [A.bset#200]
19:46:43,062 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:46:43,062 DEBUG BatcherImpl:226 - prepared statement get: delete from A_B where A_ID=?
Hibernate: delete from A_B where A_ID=?
19:46:43,062 DEBUG BatcherImpl:232 - preparing statement
19:46:43,062 DEBUG LongType:46 - binding '200' to parameter: 1
19:46:43,062 DEBUG BatcherImpl:28 - Adding to batch
19:46:43,062 DEBUG BasicCollectionPersister:509 - done deleting collection
19:46:43,062 DEBUG BatcherImpl:50 - Executing batch size: 1
19:46:43,062 DEBUG BatcherImpl:58 - success of batch update unknown: 0
19:46:43,062 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:46:43,062 DEBUG BatcherImpl:245 - closing statement
19:46:43,062 DEBUG EntityPersister:597 - Deleting entity: [B#1000]
19:46:43,062 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:46:43,062 DEBUG BatcherImpl:226 - prepared statement get: delete from B where B_ID=?
Hibernate: delete from B where B_ID=?
19:46:43,062 DEBUG BatcherImpl:232 - preparing statement
19:46:43,078 DEBUG LongType:46 - binding '1000' to parameter: 1
19:46:43,078 DEBUG BatcherImpl:28 - Adding to batch
19:46:43,078 DEBUG EntityPersister:597 - Deleting entity: [A#200]
19:46:43,078 DEBUG BatcherImpl:50 - Executing batch size: 1
19:46:43,078 DEBUG BatcherImpl:58 - success of batch update unknown: 0
19:46:43,078 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:46:43,078 DEBUG BatcherImpl:245 - closing statement
19:46:43,078 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
19:46:43,078 DEBUG BatcherImpl:226 - prepared statement get: delete from A where A_ID=?
Hibernate: delete from A where A_ID=?
19:46:43,078 DEBUG BatcherImpl:232 - preparing statement
19:46:43,078 DEBUG LongType:46 - binding '200' to parameter: 1
19:46:43,078 DEBUG BatcherImpl:28 - Adding to batch
19:46:43,078 DEBUG BatcherImpl:50 - Executing batch size: 1
19:46:43,078 DEBUG BatcherImpl:58 - success of batch update unknown: 0
19:46:43,078 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
19:46:43,094 DEBUG BatcherImpl:245 - closing statement
19:46:43,094 DEBUG SessionImpl:2703 - post flush
Process terminated with exit code 0


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 1:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
OH, sorry. No, of course it won't. I thought the collection in A was a collection of Cs. I didn't realize that there was another B class floating around.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2003 2:56 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Then we are back to original question :)

Quote:
If it is normal, how am I supposed to remove corresponding records from C_A table? Using DB triggers/integrity constraints or there is another way?

Btw, if trigger/constraint is required for C_A, why Hibernate does clean up A_B table?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.