-->
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: Cascade save generates update instead of insert for retry
PostPosted: Wed Apr 05, 2006 9:23 am 
Newbie

Joined: Tue Apr 04, 2006 9:56 am
Posts: 10
Hi All,
I have a table(SemiFlatTo) which has two children(Child1To and Child2To). And they are related by column which is generated by sequence "VAE_SEQ".

My requirement is to do cascade save of all three tables. well everuthing works fine now.
But lately I got another requirement, in which I have to save collection of SemiFlatTo's as batch update. In this case, insert is successful only if all the SemiFlatTo's are inserted, even if one fails, all the other SemiFlatTo's will be rolled back. In this condition, I have to traverse each of the SemiFlatTo's individually and do a insert.
Now when th batch insert fails and when I want to insert one by one, hibernate generates update statements for children instead of insert stm. The log below clearly shows all the steps. Can you please tell me why hibernate is generating update stm instead of insert statement for children.
Thank You in advance


[Apr 05, 2006 08:59:46] DEBUG [DriverManagerConnectionProvider] - total checked-out connections: 0
[Apr 05, 2006 08:59:46] DEBUG [DriverManagerConnectionProvider] - using pooled JDBC connection, pool size: 0
[Apr 05, 2006 08:59:46] DEBUG [JDBCTransaction] - begin
[Apr 05, 2006 08:59:46] DEBUG [JDBCTransaction] - current autocommit status:false
[Apr 05, 2006 08:59:46] DEBUG [BatcherImpl] - about to open: 0 open PreparedStatements, 0 open ResultSets
[Apr 05, 2006 08:59:46] DEBUG [BatcherImpl] - values nextval for VAE_SEQ
Hibenate: values nextval for VAE_SEQ
[Apr 05, 2006 08:59:46] DEBUG [BatcherImpl] - preparing statement
[Apr 05, 2006 08:59:46] DEBUG [SequenceGenerator] - Sequence identifier generated: 256
[Apr 05, 2006 08:59:46] DEBUG [BatcherImpl] - done closing: 0 open PreparedStatements, 0 open ResultSets
[Apr 05, 2006 08:59:46] DEBUG [BatcherImpl] - closing statement
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - generated identifier: 256
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saving [com.abc.def.SemiFlatTo#256]
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - done processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - cascading to collection: com.abc.def.SemiFlatTo.child1
[Apr 05, 2006 08:59:46] DEBUG [Cascades$4] - cascading to saveOrUpdate()
[Apr 05, 2006 08:59:46] DEBUG [Cascades$15] - id unsaved-value strategy NULL
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saveOrUpdate() previously saved instance with id: 87
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - updating [com.abc.def.Child1To#87]
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - cascading to collection: com.abc.def.SemiFlatTo.child2
[Apr 05, 2006 08:59:46] DEBUG [Cascades$4] - cascading to saveOrUpdate()
[Apr 05, 2006 08:59:46] DEBUG [Cascades$16] - version unsaved-value strategy NULL
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saveOrUpdate() unsaved instance
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - running Session.finalize()
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - generated identifier: com.abc.def.Child2To@5102ff[idMfAcctgRslt=256,cdRateType=FAS]
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saving [com.abc.def.Child2To#com.abc.def.Child2Key@5102ff[idMfAcctgRslt=256,cdRateType=FAS]]
[Apr 05, 2006 08:59:46] DEBUG [Versioning] - Seeding: 2006-04-05 08:59:46.976
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - done processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [JDBCTransaction] - commit
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - flushing session
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - cascading to collection: com.abc.def.SemiFlatTo.child1
[Apr 05, 2006 08:59:46] DEBUG [Cascades$4] - cascading to saveOrUpdate()
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saveOrUpdate() persistent instance
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - cascading to collection: com.abc.def.Child2To [Apr 05, 2006 08:59:46] DEBUG [Cascades$4] - cascading to saveOrUpdate()
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - saveOrUpdate() persistent instance
[Apr 05, 2006 08:59:46] DEBUG [Cascades] - done processing cascades for: com.abc.def.SemiFlatTo
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - Flushing entities and processing referenced collections
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - Collection found: [com.abc.def.SemiFlatTo.child1#256], was: [<unreferenced>]
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - Collection found: [com.abc.def..SemiFlatTo.child2To#256], was: [<unreferenced>]
[Apr 05, 2006 08:59:46] DEBUG [SessionImpl] - Updating entity: [com.abc.def.Child1To#87]
[Apr 05, 2006 08:59:46] DEBUG [JDBCTransaction] - rollback
[Apr 05, 2006 08:59:47] DEBUG [SessionImpl] - transaction completion
[Apr 05, 2006 08:59:47] ERROR [HibernatePersistenceManager] - Exception occured in insert To


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

_________________
Cheers,
Don't forget to rate the post, Thank You


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 9:33 am 
Newbie

Joined: Tue Apr 04, 2006 9:56 am
Posts: 10
Can anyone help me in this regard...
Thank You

_________________
Cheers,
Don't forget to rate the post, Thank You


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.