-->
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: failed to save --- no exception...?
PostPosted: Thu Oct 06, 2005 7:47 am 
Regular
Regular

Joined: Mon May 30, 2005 11:20 pm
Posts: 66
Hi, I am trying to save an object to database. While the save() statement executed without any exception, nothing actually get saved!? I was monitoring using SQL Profiler - no INSERT statement was ever issued... What's special about this class is that it's got a composite ID - one of the key is an "Object" (ie. not intrinsic type)

Basically, alll I did was:
Code:
Dim sess As ISession
Dim item As inv_request_item

item = UIManager.GetItem()
sess = connManager.GetSession()
sess.save(item) 'NO EXCEPTION BUT NOTHING GETS SAVED


So... simple right?

Here's the mapping file:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
   <class name="warehouse.to.inv_request_item, WarehouseLib" table="inv_request_item">
   
      <composite-id>
         <key-many-to-one name="ParentInvRequest" column="request_id" class="warehouse.to.InvRequest, WarehouseLib" />
         <key-property name="ItemID" column= "item_id" type="Int32" />
      </composite-id>
            
      <property name="RequestedQty" column= "requested_qty" type="Decimal" />
      <property name="RevisedQty" column="revised_qty" type="Decimal" />
      <property name="ConfirmedQty" column= "confirmed_qty" type="Decimal" />
      <property name="StatusID" column= "status_id" type="Int16" />
      <property name="Remarks" column= "remarks" type="String" length="100" />
      
      <property name="CreateBy" column= "CreateBy" type="Int32"/>
      <property name="CreateDate" column= "CreateDate" type="DateTime"/>
      <property name="LastUpdateBy" column= "LastUpdateBy" type="Int32"/>
      <property name="LastUpdateDate" column= "LastUpdateDate" type="DateTime"/>
   </class>
</hibernate-mapping>


Can anyone tells me what's wrong with this please? Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 8:05 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The database is updated only during flush which happens when the session's transaction is committed, or when you call session.Flush yourself. Calling Save on an object with identity identifier generator causes the INSERT to be executed right away but that's an exception to the general rule.


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.