-->
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.  [ 1 post ] 
Author Message
 Post subject: subclass entity-name and cascade
PostPosted: Mon Jun 14, 2010 8:08 am 
Newbie

Joined: Mon Jun 14, 2010 7:36 am
Posts: 1
Hello,

I have something like this:
Code:
<class [b]name="A"[/b] table="[b]tableA[/b]" discriminator-value="0" [b]entity-name="A"[/b]>
  <id name="id" unsaved-value="null" type="int">
    <generator class="native"/>
  </id>
  <discriminator column="someid" type="int" />
  <property name="..." />
  ...
  <subclass [b]entity-name="AA"[/b] [b]name="AA"[/b] discriminator-value="1">
  </subclass>

  <subclass entity-name="AB" name="AB" discriminator-value="2">
  </subclass>
  ....
</class>


<class [b]name="A"[/b] table="[b]tableB[/b]" discriminator-value="0" [b]entity-name="order_A"[/b]>
  <id name="id" unsaved-value="null" type="int">
    <generator class="native"/>
  </id>
  <discriminator column="someid" type="int" />
  <property name="..." />
  ...
  <subclass [b]entity-name="order_AA"[/b] [b]name="AA"[/b] discriminator-value="1">
  </subclass>
  <subclass entity-name="order_AB" name="AB" discriminator-value="2">
  </subclass>
  ....
</class>




<class name="Z1" table="tableZ1">
   ....
   <set name="someset" ... [b]cascade="save-update"[/b]>
      ...
      <many-to-many column="..." entity-name="A"/>
   </set>
   ...
</class>

<class name="Z2" table="tableZ2">
   ....
   <set name="someset" ... [b]cascade="save-update"[/b]>
      ...
      <many-to-many column="..." entity-name="order_A"/>
   </set>
   ...
</class>


class Z1 {
   Set<A> someset;
}

class Z2 {
   Set<A> someset;
}

class A { ... }
class AA extend A { ... }
class AB extend A { ... }




More info:
Classes Z1 and Z2 contain sets with AA, AB, etc but those classes are linked with two different tables (normal and ordered_normal).

Problem:
I try to save Z1 and Z2 and:
- Z1 and all objects from set save ok (normal table)
- Z2 save ok but objects from set save in wrong table - normal table instead of ordered_normal table

I think it should be problem with cascade. Any ideas how to solve this? Any "magical" switch?

Regards
Stefan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.