-->
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.  [ 10 posts ] 
Author Message
 Post subject: Problem with hibernate session
PostPosted: Mon Mar 12, 2007 10:40 am 
Newbie

Joined: Mon Sep 18, 2006 9:46 am
Posts: 13
Hi,

I am using hibernate 3. I am facing some problem with hibernate session.I am loading the data from database,when i delete the record from the list the record is deleted from the database,when i insert the same record(primary key) with different values for other columns other than primary key.It's showing the same values which is in the previous session,but in my oracle database the new data is showing with updated values.

Please help me.

With Regards,
Ahamad


Top
 Profile  
 
 Post subject: sounds like transaction problems
PostPosted: Mon Mar 12, 2007 11:31 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
Are you committing transactions correctly?

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 4:49 am 
Newbie

Joined: Mon Sep 18, 2006 9:46 am
Posts: 13
Hi,

I commit the transaction by using session.flush() and i closed the session in finally block. But still i am facing same problem

Regards,
Ahamad


Top
 Profile  
 
 Post subject: session problem
PostPosted: Tue Mar 13, 2007 4:55 am 
Beginner
Beginner

Joined: Tue Dec 12, 2006 7:52 am
Posts: 20
Hi
After commit the transaction you write code like this in finally block
session.flush() the previous object removed from the session


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:11 am 
Newbie

Joined: Mon Sep 18, 2006 9:46 am
Posts: 13
No Progress.Same problem


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:16 am 
Newbie

Joined: Tue Mar 13, 2007 4:15 am
Posts: 12
Location: Trivandrum
send the code sample

_________________
Regards
Belto


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:21 am 
Newbie

Joined: Mon Sep 18, 2006 9:46 am
Posts: 13
public void add (StudentVO student) {
try {
Transaction transaction = session.beginTransaction();
session.save(student);
transaction.commit();
} catch (Exception e) {
e.printStackTrace();
}
finally {
session.flush();
session.close();
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:33 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Why do you ignore this: http://hibernate.org/42.html

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:36 am 
Newbie

Joined: Tue Mar 13, 2007 4:15 am
Posts: 12
Location: Trivandrum
ahamad wrote:
public void add (StudentVO student) {
try {
Transaction transaction = session.beginTransaction();
session.save(student);
transaction.commit();
} catch (Exception e) {
e.printStackTrace();
}
finally {
session.flush();
session.close();
}
}


do session.evict(student);
to remove the object from cache

_________________
Regards
Belto


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 5:37 am 
Newbie

Joined: Tue Mar 13, 2007 4:15 am
Posts: 12
Location: Trivandrum
ahamad wrote:
public void add (StudentVO student) {
try {
Transaction transaction = session.beginTransaction();
session.save(student);
transaction.commit();
} catch (Exception e) {
e.printStackTrace();
}
finally {
session.flush();
session.close();
}
}


do session.evict(student);
to remove the object from cache


if object is properly inserting in to db means

wat caching u r using?

_________________
Regards
Belto


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