-->
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: possible nonthreadsafe access to session
PostPosted: Thu Mar 17, 2005 5:17 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
Hi all,

I have a problem about transaction management.

When user clicks insert, I create a transaction and call session.save, but dont commit it, untill user clicks "commit". If user "commit"s, I do some validation check on the operated object, if it is valid , then I call t.commit
else I dont commit it and rollback I changes in RAM level.

insert(Object o) {
t = session.beginTransaction();
session.save(o);
}

commit() {
if (transactionIsValid) {
t.commit;
}
else {
rollBackChangesInRAMLevel();
displayInfoMessage();
t = null;
// Object o = t.getOperatedObject();
//session.evict(o);
}
}

It seems to work, but when user tries to do another operation which is valid, and t.commit called, hibernate flushes the previous non-valid operation.

I tried session.evict(failedObject) but it gives "possible nonthreadsafe access to session" assertion error in t.commit().

What am I missing? What should I do to remove that non-valid object from Hibernate's "mind" and "heart"?

_________________
-developer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 5:32 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
ok I solve the problem by not calling session.DoSomething until user clicks commit.

_________________
-developer


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.