-->
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: hibernate and composite-element. how to remove?!
PostPosted: Tue Mar 29, 2005 1:10 am 
Newbie

Joined: Tue Jan 11, 2005 9:51 am
Posts: 10
hi there!

I was using this http://www.hibernate.org/118.html#A11 suggestion to build my mapping.

my looks the following way:

Code:
<class name="com.op.objects.Candidate" table="candidates">
   <id name="id" column="cand_CandId" type="long" unsaved-value="0">
      <generator class="native" />
   </id>
...
   <set name="skills" table="cand_skillset" lazy="true" inverse="true" cascade="all-delete-orphan">
      <key column="candskill_CandId"/>
      <composite-element class="com.op.objects.CandidateSkill">
         <property name="numberOfYears" type="integer" column="candskill_Years"/>
         <many-to-one name="skill" class="com.op.objects.Skill" column="candskill_SkillId"/>
      </composite-element>
   </set>
...
</class>


everything works perfectly well while fetching already existed information in database.

so, for each com.op.objects.Candidate object we have Set of com.op.objects.CandidateSkill objects, for each of them we can call .getSkill() and get com.op.objects.Skill object. everything is perfect from this side.

but how can we remove any com.op.objects.CandidateSkill from Set?
I thought that "all-delete-orphan" at least somehow will help me, but when I am doing (i.e. for candidate with id = 10):

Code:
...
Candidate per = (Candidate) sess.get(Candidate.class, new Long(10));
sess.delete(per);
...


I am getting an exception No persister for: com.op.objects.CandidateSkill...

is there any way out?

thank you in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 2:15 am 
Newbie

Joined: Tue Jan 11, 2005 9:51 am
Posts: 10
solved. thanks.


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.