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.  [ 3 posts ] 
Author Message
 Post subject: SaveOrUpdate - Inconsistent Behavior
PostPosted: Tue Sep 11, 2007 5:56 pm 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
Hello,

I've just discovered that SaveOrUpdate doesn't behave consistently for oracle & sqlserver.

In sqlserver new instances are actually inserted into the table before the transaction is committed in order to generate an identity value (on the primary key).

This means that I can run raw sql against the row as long as the sql runs in the same transaction as the insert.

In oracle new instances are not inserted. Instead I only see a select against the sequence.

This means that I cannot run raw sql against the row (since it is not there yet).

Is there a way around this? I mean is there a way I can make the nhibernate on oracle to behave like nhibernate on sqlserver?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 12, 2007 2:40 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Hi,

We've had the same problem, and were able to solve it by adding a Flush() right after the SaveOrUpdate(). This will send the actual SQL statements to the server thus making the rows 'available'.
Use a transaction around all this to ensure that all changes are committed (or rolled back) consistently.

_________________
Please rate this post if it helped.

X.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 15, 2007 3:39 am 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
xasp wrote:
Hi,

We've had the same problem, and were able to solve it by adding a Flush() right after the SaveOrUpdate(). This will send the actual SQL statements to the server thus making the rows 'available'.
Use a transaction around all this to ensure that all changes are committed (or rolled back) consistently.


Yup, I do the same thing with Oracle.

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


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