-->
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: saveorupdate vs save
PostPosted: Tue Mar 08, 2005 12:58 am 
Newbie

Joined: Wed Feb 16, 2005 2:10 am
Posts: 3
what is the difference between session.saveorupdate() and sesssion.save(). when to use saveorupdate ? I tried to insert a row with saveOrUpdate but it gave me Could not synchronize database state with session , SQL insert, update or delete failed (row not found) error.

when i changed it to session.save() it worked.

can someone tell the difference ?



here is my hbm.xml file


<class
name="*****Rule"
table="vlid_rules"
>

<id
name="ruleKey"
type="java.math.BigDecimal"
column="RULE_KEY"
>
<generator class="assigned" />
</id>

<property
name="ruleName"
type="java.lang.String"
column="RULE_NAME"
not-null="true"
unique="true"
length="64"
/>
<property
name="ruleSetName"
type="java.lang.String"
column="RULE_SET_NAME"
not-null="true"
unique="true"
length="64"
/>
<property
name="ruleType"
type="java.lang.String"
column="RULE_TYPE"
length="32"
/>
<property
name="ruleDescription"
type="java.lang.String"
column="RULE_DESCRIPTION"
length="65535"
/>
<property
name="className"
type="java.lang.String"
column="CLASS_NAME"
length="64"
/>
<property
name="methodName"
type="java.lang.String"
column="METHOD_NAME"
length="64"
/>
<property
name="errorMessage"
type="java.lang.String"
column="ERROR_MESSAGE"
length="65535"
/>
<property
name="document"
type="java.lang.String"
column="DOCUMENT"
length="65535"
/>
<property
name="negate"
type="java.lang.Boolean"
column="NEGATE"
length="1"
/>
<property
name="failIfNull"
type="java.lang.Boolean"
column="FAIL_IF_NULL"
length="1"
/>
<property
name="stopIfFail"
type="java.lang.Boolean"
column="STOP_IF_FAIL"
length="1"
/>
<property
name="continueIfNull"
type="java.lang.Boolean"
column="CONTINUE_IF_NULL"
length="1"
/>
<property
name="global"
type="java.lang.Boolean"
column="GLOBAL"
length="1"
/>

<!-- Associations -->

<!-- bi-directional one-to-many association to RuleAttribute -->
<set
name="attributes"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="RULE_KEY" />
</key>
<one-to-many
class="*******RuleAttribute"
/>
</set>

</class>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 11:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-updating-detached


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.