-->
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: Newbie: SaveOrUpdate saving, not updating
PostPosted: Sat Aug 04, 2007 1:10 pm 
Newbie

Joined: Tue Sep 07, 2004 7:12 pm
Posts: 7
Hi,

I'm am developing a small app, where I have an ObjectManager; this manager receives read and write requests from business and UI layers. For each request, it open a session, loads/saveOrUpdate objects and the session is then closed. For a new created object, SaverOrUpdate affects the MySQL data base correctly. Bur for objects that are modified in the UI, the db is not affected by SaveOrUpdate; the record is not changed.
Here is the mapping file for the object I'm having problems with:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BlockNotas_3.ClasesBD.Nota, BlockNotas_3" table="nota">
<id name="oid" column="oid_nota" type="Int64" unsaved-value="0">
<generator class="identity"/>
</id>
<property name="titulo" column="not_titulo" type="String" length="45"/>
<property name="textoNota" column="not_nota" type="String" />
<property name="fecha" column="not_fecha" type="DateTime"/>
<many-to-one name="tipoNota" column="oid_tiponota" cascade="none"/>
</class>
</hibernate-mapping>

I'd appreciate any help.

Thank you,
Guillermo

_________________
Guillermo


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 04, 2007 2:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
It sounds like you are doing the right things. One common mistake (if one is not using a transaction) is forgetting to flush the session before closing it. If that is not it, you may want to post your code between the opening and closing of the session here.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 04, 2007 2:44 pm 
Newbie

Joined: Tue Sep 07, 2004 7:12 pm
Posts: 7
Thank you Karl,

I missed to begin and commit a transaction; now it works.

_________________
Guillermo


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.