-->
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.  [ 6 posts ] 
Author Message
 Post subject: Row not inserting properly and What is ScheduledInsertion?
PostPosted: Sat Dec 02, 2006 5:54 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
Hibernate version: NHibernate1.2.0Beta

Name and version of the database you are using: SQL Server 2000

The generated SQL (show_sql=true): none

I have a payment table in my database that I am able to persist to fine most of the time. When I'm adding the payment right after I add the associated order it works fine. When I try to add a payment to an existing order I don't get an error, and I get an ID generated by nHibernate for the new payment, but the row never gets created in the database.

I debugged into the nhibernate dlls and saw that it was calling something called ScheduledInsertion. Does this mean it wants to do the insertion asynchronously? I don't want it to work that way if that is what it is trying to do.

In both situations the same block of code is being called to persist the payment object. The only difference in the case when it doesn't work is, the block of code that saves the payment isn't nested in other methods that save other object types to the db. It is being called stand alone.

I get no error messages and I get no SQL in my logs other than some SELECT statements that are superfluous to my problem.

Please help!

and

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 6:44 pm 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
You are not calling Flush(), are you?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 12:25 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
I am not calling flush


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 1:17 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
I just psuedo fixed the problem. Wrapping it in a transaction somehow forced it to insert to the database. I don't want it in a transaction since it's just a single insert. Can anyone help shed some light?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 1:42 pm 
Newbie

Joined: Mon Mar 27, 2006 10:24 am
Posts: 8
Location: Malmoe, Sweden
Your objects are not persisted untill you call flush. When you commit a transaction the session is automatically flushed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 3:14 pm 
Beginner
Beginner

Joined: Mon Oct 02, 2006 6:46 pm
Posts: 32
thanks, that was the problem


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