-->
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.  [ 7 posts ] 
Author Message
 Post subject: need of flush() with commit() in one-to-many association?
PostPosted: Thu May 26, 2005 5:16 am 
Newbie

Joined: Thu May 26, 2005 4:17 am
Posts: 5
Location: Bangalore
hi,
I request somebody to answer to my doubt ("need of flush() with commit() in one-to-many associations")as early as possible.
regards,
anil

_________________
hi,
I am from b'lore working for "NEXTLINX INDIA LTD".


Top
 Profile  
 
 Post subject: basicaly no flush is needed
PostPosted: Thu May 26, 2005 7:27 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
basically there is no need to flush before commit because commit will do it


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 9:53 am 
Newbie

Joined: Thu May 26, 2005 4:17 am
Posts: 5
Location: Bangalore
hi,
Thanks for ur reply.
I have even done that and I have clearly mentioned about it in my issue.As I said I have tried commit() with out flush() but the data is not being persisted in the database.So finally I have done both flush() and commit() .
So u pls give me someother effecitve solution.
regards,
anil

_________________
hi,
I am from b'lore working for "NEXTLINX INDIA LTD".


Top
 Profile  
 
 Post subject: environment
PostPosted: Thu May 26, 2005 10:10 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Are you using hibernate standalone or with application server?


Top
 Profile  
 
 Post subject: working snipet of code
PostPosted: Thu May 26, 2005 10:17 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Code:
        Session s = ....
       
        Product product = new Product();
        product.setId(new Long(1));
        product.setName("xxx");
        product.setDescription("xxx ");

        s.saveOrUpdate(product);
        s.connection().commit();


note: in managed envoronment do flush and close (not commit)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 10:19 am 
Beginner
Beginner

Joined: Thu Sep 16, 2004 4:36 am
Posts: 22
anilkumar,

if you commit yourself, don't forget to set session.setFlushMode(FlushMode.COMMIT);


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 1:59 am 
Newbie

Joined: Thu May 26, 2005 4:17 am
Posts: 5
Location: Bangalore
mr sejo,
may I know why do we need to explicitly set the FLUSHMODE to commit.Because there is a chance that this setting may expose us to stale data i.e,modifications we we will make to the objects only in memory may conflict with the results of the query.
So I hope that u will give me some other effective solution for my issue that I had posted.
regards,
anil

_________________
hi,
I am from b'lore working for "NEXTLINX INDIA LTD".


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