-->
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.  [ 5 posts ] 
Author Message
 Post subject: evict does not work
PostPosted: Mon Dec 05, 2005 11:52 am 
Newbie

Joined: Mon Aug 15, 2005 11:25 am
Posts: 10
Hi,

I'm trying to evict an object. It is an object (DirectoryEntry) that have some attributes (Descriptor).

I get this object from the DB and I want to evict it to add the descriptor and put the directory entry to the session scope. But I don't want that the descriptor is saved in the DB.

I am in a spring context web application.
Here is the code :

Code:
directoryEntry = (DirectoryEntry) this.dataAccessObject.findDirectoryEntryByInboxURL(inboxURL);
this.dataAccessObject.evict(directoryEntry);
directoryEntry.setDescriptor(new Descriptor());


When I do this, the descriptor is saved in the DB...

If you can help me...

Thank you...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 1:10 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Code:
session.evict(directoryEntry );

if(session.contains(directoryEntry)){
  System.out.println("you're saying this prints?");
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 3:59 am 
Newbie

Joined: Mon Aug 15, 2005 11:25 am
Posts: 10
Thank for your help.

I am in a spring context.
So here is my dataAccessObject class :

Code:
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class HibernateDataAccessObject extends HibernateDaoSupport;


And here is the evict method of this class :

Code:
   public void evict(Object o) throws CoreException {
      
      try {
         
         getHibernateTemplate().evict(o);
         
      } catch (DataAccessException e) {
         
         e.printStackTrace();
         
         CoreException ce = new CoreException();
         ce.setErrorCode(IDAOExceptionConstants.ERROR_CODE_GENERAL_FAILURE);
         ce.initCause(e);
         ce.setStackTrace(e.getStackTrace());

         throw ce;
      }
   }



When I do it, no exception appear...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 4:28 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Can you show you mapping ?

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 06, 2005 5:08 am 
Newbie

Joined: Mon Aug 15, 2005 11:25 am
Posts: 10
Sure...

Code:
   <!--  ********************************************************************
                        DIRECTORY_ENTRY TABLE
   ********************************************************************** -->
   <class name="com.evidence3.core.model.directory.DirectoryEntry" table="directory_entry">
      <id name="id" type="long">
         <generator class="identity"/>
      </id>

      <property name="pseudo"/>
      <property name="email"/>
      <property name="firstname"/>
      <property name="lastname"/>
      <property name="inboxURL" column="inbox_url"/>
      <many-to-one name="nonRepudiationDescriptor" class="com.evidence3.core.model.common.descriptors.NonRepudiationDescriptor" column="non_repudiation_descriptor_id" cascade="all"/>
      <many-to-one name="confidentialityDescriptor" class="com.evidence3.core.model.common.descriptors.ConfidentialityDescriptor" column="confidentiality_descriptor_id" cascade="all"/>
      <many-to-one name="systemUser" class="com.evidence3.core.model.user.SystemUser" column="system_user_id" cascade="none" unique="true" not-null="false"/>

      <set name="directories" table="directory_directory_entry" cascade="save-update" inverse="true">
         <key column="directory_entry_id"/>
         <many-to-many column="directory_id" class="com.evidence3.core.model.directory.Directory"/>
      </set>
      <set name="externalCommunities" table="directory_entry_external_community" cascade="all">
         <key column="directory_entry_id"/>
         <many-to-many column="external_community_id" class="com.evidence3.core.model.directory.ExternalCommunity"/>
      </set>
   </class>


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