-->
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: Prevent changes from being persisted
PostPosted: Mon Oct 23, 2006 9:04 am 
Newbie

Joined: Thu Oct 19, 2006 9:26 am
Posts: 4
Hi,
I'm building a windows Forms application using nhibernate. Here's my problem.
I have an object (ClassCliente) witch contains a collection(Contactos). I want to be able to undo the changes done to that collection if i cancel the operation of editing an object(ClassCliente).
The problem is that, if i reload the objects it persists to the database the changes i have done. And if i dont reload the objects, the ones in memory still present the canges I have done to the collection.

Code:
<class name="ClassCliente" table="Clientes" lazy="false">
     <id name="ID" type="Int32" unsaved-value="-1">
   <generator class="identity" />
     </id>
     <property name="Nome" type="String" length="50"/>
     <bag name="Contactos" table="Contactos" lazy="true">
   <key column="IDClientes"/>
   <composite-element class="ClassContacto">
      <parent name="Cliente" />
      <property name="Contacto"/>
      <many-to-one name="TipoContacto" column="IDTipoContactos"  class="ClassTipoContacto"/>
   </composite-element>
     </bag>
</class>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 10:03 pm 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
This may help you

Code:
NHibernate.ISession.Evict(System.Object)


Evict the ClassCliente object instance before you reload it.


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.