(a) you are using Hibernate 2.1
yes hibernate2.1 beta5
(b) your version property is of nonprimitive type and is initialzed to a null value when the object is instantiated.
beforehand i declared the version property as int primitive type and it was initialized to 0 by hibernate but now i made it to Integer type and again it is instantiated to 0 when object is instantiated.(Do i have to do something here on my own ?)
Set unsaved-value="none" for both parent and child.
And after doing the changes i created a parent and child and it worked fine. Now when i try to update the created parent and child it tries to insert the parent and throws the error. The stack trace is :
11:27:15,215 INFO Environment:432 - Hibernate 2.1 beta 5
11:27:15,231 INFO Environment:466 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, hibernate.cglib.use_reflection_optimizer=true, hibernate.jndi.class=com.ibm.websphere.naming.WsnInitialContextFactory, hibernate.dialect=net.sf.hibernate.dialect.OracleDialect, hibernate.jndi.url=iiop://localhost:2809, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=BGM_CONTRACTS, hibernate.connection.url=jdbc:oracle:thin:@10.25.39.138:1521:BGMIT, hibernate.show_sql=false, hibernate.connection.password=BGM_CONTRACTS, hibernate.statement_cache.size=0, hibernate.connection.pool_size=1}
11:27:15,231 INFO Environment:480 - using java.io streams to persist binary types
11:27:15,247 INFO Environment:481 - using CGLIB reflection optimizer
11:27:15,247 INFO Configuration:303 - Mapping resource: com/bunge/bgm/contract/business/domain/user/Child.hbm.xml
11:27:15,825 DEBUG DTDEntityResolver:20 - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
11:27:15,825 DEBUG DTDEntityResolver:29 - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
11:27:16,059 INFO Binder:198 - Mapping class: com.bunge.bgm.contract.business.domain.user.Child -> T_CHILD
11:27:16,184 DEBUG Binder:410 - Mapped property: _id -> CHILD_ID, type: integer
11:27:16,184 DEBUG Binder:410 - Mapped property: _childColumn -> CHILD_COLUMN, type: integer
11:27:16,215 DEBUG Binder:410 - Mapped property: _text -> CHILD_NAME, type: string
11:27:16,231 DEBUG Binder:410 - Mapped property: _parent -> PARENT_ID, type: com.bunge.bgm.contract.business.domain.user.Parent
11:27:16,231 INFO Configuration:303 - Mapping resource: com/bunge/bgm/contract/business/domain/user/Parent.hbm.xml
11:27:16,231 DEBUG DTDEntityResolver:20 - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
11:27:16,247 DEBUG DTDEntityResolver:29 - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
11:27:16,262 INFO Binder:198 - Mapping class: com.bunge.bgm.contract.business.domain.user.Parent -> T_PARENT
11:27:16,262 DEBUG Binder:410 - Mapped property: _id -> ID, type: integer
11:27:16,278 DEBUG Binder:410 - Mapped property: _parentColumn -> PARENT_COLUMN, type: integer
11:27:16,278 DEBUG Binder:410 - Mapped property: _text -> NAME, type: string
11:27:16,309 DEBUG Binder:410 - Mapped property: _child, type: java.util.Collection
11:27:16,309 INFO Configuration:563 - processing one-to-many association mappings
11:27:16,309 DEBUG Binder:1249 - Second pass for collection: com.bunge.bgm.contract.business.domain.user.Parent._child
11:27:16,309 INFO Binder:1074 - Mapping collection: com.bunge.bgm.contract.business.domain.user.Parent._child -> T_CHILD
11:27:16,309 DEBUG Binder:1261 - Mapped collection key: PARENT_ID, one-to-many: com.bunge.bgm.contract.business.domain.user.Child
11:27:16,309 INFO Configuration:572 - processing one-to-one association property references
11:27:16,309 INFO Configuration:597 - processing foreign key constraints
11:27:16,325 DEBUG Configuration:607 - resolving reference to class: com.bunge.bgm.contract.business.domain.user.Parent
11:27:16,372 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.OracleDialect
11:27:16,387 INFO SettingsFactory:62 - Use outer join fetching: true
11:27:16,387 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
11:27:16,387 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
11:27:16,465 INFO DriverManagerConnectionProvider:71 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@10.25.39.138:1521:BGMIT
11:27:16,465 INFO DriverManagerConnectionProvider:72 - connection properties: {user=BGM_CONTRACTS, password=BGM_CONTRACTS}
11:27:16,481 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (use of process level read-write cache is not recommended)
11:27:16,481 DEBUG DriverManagerConnectionProvider:78 - total checked-out connections: 0
11:27:16,481 DEBUG DriverManagerConnectionProvider:94 - opening new JDBC connection
11:27:17,606 DEBUG DriverManagerConnectionProvider:100 - created connection to: jdbc:oracle:thin:@10.25.39.138:1521:BGMIT, Isolation Level: 2
11:27:17,622 DEBUG DriverManagerConnectionProvider:114 - returning connection to pool, pool size: 1
11:27:17,622 INFO SettingsFactory:89 - Use scrollable result sets: true
11:27:17,622 INFO SettingsFactory:99 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
11:27:17,622 INFO SettingsFactory:110 - cache provider: net.sf.hibernate.cache.JCSCacheProvider
11:27:17,622 INFO Configuration:990 - instantiating and configuring caches
11:27:17,794 INFO SessionFactoryImpl:115 - building session factory
11:27:17,794 DEBUG SessionFactoryImpl:121 - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=BGM_CONTRACTS, sun.boot.library.path=C:\j2sdk1.4.2_01\jre\bin, java.vm.version=1.4.2_01-b06, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=BGM_CONTRACTS, 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, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\BGMIT\apps\Contract_Service, 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\crvashi\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.java2d.fontpath=, java.library.path=C:\j2sdk1.4.2_01\jre\bin;.;C:\WINNT\system32;C:\WINNT;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRA~1\CA\Common\SCANEN~1;C:\PROGRA~1\CA\eTrust\INOCUL~1;C:\Program Files\Rational\common;C:\Program Files\Rational\Rose\TopLink\;C:\ANT\apache-ant-1.5.3-1\bin;C:\j2sdk1.4.2_01\bin;C:\BGMIT\apps\Contract_Service\build\classes\hibernate.properties, hibernate.jndi.url=iiop://localhost:2809, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.connection.pool_size=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.0, user.home=C:\Documents and Settings\crvashi, user.timezone=America/New_York, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, java.class.path=C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\eclipse\plugins\com.cortexeb.tools.clover_1.1.2\clover-eclipse.jar;C:\BGMIT\apps\Contract_Service\build\classes;Z:\lib\activation.jar;Z:\lib\bootstrap.jar;Z:\lib\checkstyle.jar;Z:\lib\classes12.zip;Z:\lib\commons-beanutils.jar;Z:\lib\commons-collections.jar;Z:\lib\commons-dbcp.jar;Z:\lib\commons-digester.jar;Z:\lib\commons-fileupload.jar;Z:\lib\commons-lang.jar;Z:\lib\commons-logging.jar;Z:\lib\commons-pool.jar;Z:\lib\commons-resources.jar;Z:\lib\commons-validator.jar;Z:\lib\crimson.jar;Z:\lib\dom4j.jar;Z:\lib\j2ee.jar;Z:\lib\jakarta-commons-logging-1.0.2.jar;Z:\lib\jakarta-oro.jar;Z:\lib\jaxp.jar;Z:\lib\jaxrpc-api.jar;Z:\lib\jbossall-client.jar;Z:\lib\jnp-client.jar;Z:\lib\junit.jar;Z:\lib\junit-3.8.1.jar;Z:\lib\junitperf.jar;Z:\lib\kilim.jar;Z:\lib\kilim-tools.jar;Z:\lib\log4j.jar;Z:\lib\log4j-1.2.6.jar;Z:\lib\mail.jar;Z:\lib\nanoxml-lite-2_2_1.jar;Z:\lib\rowset.jar;Z:\lib\servlet.jar;Z:\lib\taglibs-datetime.jar;Z:\lib\taglibs-log.jar;Z:\lib\wsanttasks.jar;Z:\lib\xalan.jar;Z:\lib\xalan-0.19.1.jar;Z:\lib\xalan-2.5.1.jar;Z:\lib\xdb.jar;Z:\lib\xercesImpl.jar;Z:\lib\xercesImpl-2.4.0.jar;Z:\lib\xmlParserAPIs.jar;Z:\lib\xmlparserv2.jar;C:\hibernate-2.1\lib\ant.jar;C:\hibernate-2.1\lib\c3p0.jar;C:\hibernate-2.1\lib\cglib-asm.jar;C:\hibernate-2.1\lib\connector.jar;C:\hibernate-2.1\lib\jaas.jar;C:\hibernate-2.1\lib\jcs.jar;C:\hibernate-2.1\lib\jdbc2_0-stdext.jar;C:\hibernate-2.1\lib\jgroups.jar;C:\hibernate-2.1\lib\jta.jar;C:\hibernate-2.1\lib\odmg.jar;C:\hibernate-2.1\lib\optional.jar;C:\hibernate-2.1\lib\oscache.jar;C:\hibernate-2.1\lib\proxool.jar;C:\hibernate-2.1\lib\swarmcache.jar;C:\hibernate-2.1\lib\xalan.jar;C:\hibernate-2.1\lib\xerces.jar;C:\hibernate-2.1\lib\xml-apis.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\runtime.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\namingclient.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\wssec.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\sas.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\ecutils.jar;Z:\axis\axis.jar;Z:\axis\commons-discovery.jar;C:\BGMIT\apps\Contract_Web\lib\BGMFramework.jar;C:\BGMIT\apps\Contract_Web\lib\BGMDataHandlers.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\optionalLibraries\Apache\Struts\1.1\struts.jar;Z:\lib\saaj.jar;C:\hibernate-2.1\hibernate2.jar;Z:\BGM_EJB_ServiceFacade.jar;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1\runtimes\base_v5\lib\naming.jar, user.name=crvashi, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.show_sql=false, 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.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@10.25.39.138:1521:BGMIT, 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, hibernate.jdbc.use_streams_for_binary=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.jdbc.batch_size=0, file.separator=\, hibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.statement_cache.size=0, hibernate.jndi.class=com.ibm.websphere.naming.WsnInitialContextFactory, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
11:27:18,372 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
11:27:18,372 DEBUG SessionFactoryObjectFactory:76 - registered: 8a990b1cf90e90f500f90e90f7d40000 (unnamed)
11:27:18,372 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
11:27:18,372 DEBUG SessionFactoryImpl:187 - instantiated session factory
11:27:18,465 DEBUG SessionImpl:478 - opened session
11:27:18,465 DEBUG JDBCTransaction:36 - begin
11:27:18,465 DEBUG DriverManagerConnectionProvider:78 - total checked-out connections: 0
11:27:18,465 DEBUG DriverManagerConnectionProvider:84 - using pooled JDBC connection, pool size: 0
11:27:18,481 DEBUG SessionImpl:735 - saving [com.bunge.bgm.contract.business.domain.user.Parent#2]
11:27:18,481 DEBUG Cascades:356 - processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,497 DEBUG Cascades:364 - done processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,497 DEBUG Versioning:35 - Seeding: 0
11:27:18,497 DEBUG SessionImpl:2808 - Wrapped collection in role: com.bunge.bgm.contract.business.domain.user.Parent._child
11:27:18,512 DEBUG Cascades:356 - processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,512 DEBUG Cascades:381 - cascading to collection: com.bunge.bgm.contract.business.domain.user.Parent._child
11:27:18,528 DEBUG Cascades:105 - cascading to saveOrUpdate()
11:27:18,528 DEBUG SessionImpl:1291 - saveOrUpdate() unsaved instance
11:27:18,528 DEBUG SessionImpl:735 - saving [com.bunge.bgm.contract.business.domain.user.Child#2]
11:27:18,528 DEBUG Versioning:35 - Seeding: 0
11:27:18,528 DEBUG Cascades:364 - done processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,528 DEBUG JDBCTransaction:54 - commit
11:27:18,528 DEBUG SessionImpl:2242 - flushing session
11:27:18,528 DEBUG Cascades:356 - processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,528 DEBUG Cascades:381 - cascading to collection: com.bunge.bgm.contract.business.domain.user.Parent._child
11:27:18,528 DEBUG Cascades:105 - cascading to saveOrUpdate()
11:27:18,544 DEBUG SessionImpl:1277 - saveOrUpdate() persistent instance
11:27:18,544 DEBUG Cascades:364 - done processing cascades for: com.bunge.bgm.contract.business.domain.user.Parent
11:27:18,544 DEBUG SessionImpl:2353 - Flushing entities and processing referenced collections
11:27:18,544 DEBUG SessionImpl:2838 - Collection found: [com.bunge.bgm.contract.business.domain.user.Parent._child#2], was: [<unreferenced>]
11:27:18,544 DEBUG SessionImpl:2680 - Processing unreferenced collections
11:27:18,544 DEBUG SessionImpl:2691 - Scheduling collection removes/(re)creates/updates
11:27:18,559 DEBUG SessionImpl:2254 - Flushed: 2 insertions, 0 updates, 0 deletions to 2 objects
11:27:18,559 DEBUG SessionImpl:2259 - Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
11:27:18,575 DEBUG Printer:74 - listing entities:
11:27:18,575 DEBUG Printer:81 - com.bunge.bgm.contract.business.domain.user.Child{_parent=Parent#2, _childColumn=0, _id=2, _text=Child3}
11:27:18,575 DEBUG Printer:81 - com.bunge.bgm.contract.business.domain.user.Parent{_id=2, _child=[Child#2], _parentColumn=0, _text=Parent3}
11:27:18,575 DEBUG SessionImpl:2291 - executing flush
11:27:18,575 DEBUG EntityPersister:508 - Inserting entity: [com.bunge.bgm.contract.business.domain.user.Parent#2]
11:27:18,575 DEBUG EntityPersister:509 - Version: 0
11:27:18,575 DEBUG BatcherImpl:192 - about to open: 0 open PreparedStatements, 0 open ResultSets
11:27:18,575 DEBUG BatcherImpl:226 - prepared statement get: insert into BGM_COMPONENTS.T_PARENT (PARENT_COLUMN, NAME, ID) values (?, ?, ?)
11:27:18,575 DEBUG BatcherImpl:232 - preparing statement
11:27:18,622 DEBUG EntityPersister:398 - Dehydrating entity: [com.bunge.bgm.contract.business.domain.user.Parent#2]
11:27:18,684 DEBUG BatcherImpl:199 - done closing: 0 open PreparedStatements, 0 open ResultSets
11:27:18,684 DEBUG BatcherImpl:245 - closing statement
11:27:18,700 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException: ORA-00001: unique constraint (BGM_COMPONENTS.PK_PARENT) violated
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:523)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:498)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2294)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:56)
at com.bunge.bgm.contract.business.domain.user.ParentMain.createParent(ParentMain.java:52)
at com.bunge.bgm.contract.business.domain.user.ParentMain.main(ParentMain.java:104)
11:27:18,700 WARN JDBCExceptionReporter:38 - SQL Error: 1, SQLState: 23000
11:27:18,700 ERROR JDBCExceptionReporter:46 - ORA-00001: unique constraint (BGM_COMPONENTS.PK_PARENT) violated
11:27:18,700 ERROR JDBCExceptionReporter:38 - could not insert: [com.bunge.bgm.contract.business.domain.user.Parent#2]
java.sql.SQLException: ORA-00001: unique constraint (BGM_COMPONENTS.PK_PARENT) violated
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:523)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:498)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2294)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:56)
at com.bunge.bgm.contract.business.domain.user.ParentMain.createParent(ParentMain.java:52)
at com.bunge.bgm.contract.business.domain.user.ParentMain.main(ParentMain.java:104)
11:27:18,715 ERROR SessionImpl:2302 - Could not synchronize database state with session
net.sf.hibernate.JDBCException: could not insert: [com.bunge.bgm.contract.business.domain.user.Parent#2]
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:533)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:498)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2340)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2294)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:56)
at com.bunge.bgm.contract.business.domain.user.ParentMain.createParent(ParentMain.java:52)
at com.bunge.bgm.contract.business.domain.user.ParentMain.main(ParentMain.java:104)
Caused by: java.sql.SQLException: ORA-00001: unique constraint (BGM_COMPONENTS.PK_PARENT) violated
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:523)
... 8 more
11:27:18,715 DEBUG JDBCTransaction:73 - rollback
11:27:18,715 DEBUG SessionImpl:508 - transaction completion
11:27:18,715 DEBUG SessionImpl:496 - closing session
11:27:18,715 DEBUG SessionImpl:3283 - disconnecting session
11:27:18,715 DEBUG DriverManagerConnectionProvider:114 - returning connection to pool, pool size: 1
11:27:18,715 DEBUG SessionImpl:508 - transaction completion
Still i get a feel that something is missing at my end. Is it related to unsaved-value attribute and its value "none" ? I dont know how does Hibernate comes to know about cascade updates for assigned identifiers.