Hi,

I have the problem, that when I use an @Embedded object within my 
inheritance-strategy,
the entities will not be fetched correctly. When I change the annotation to 
@Transient,
all corresponding entities are fetched correctly.

This is an example of my class structure:


  | @Entity
  | @Table(name="baseClass")
  | @Inheritance(strategy=InheritanceType.JOINED)
  | public abstract class BaseClass implements Serializable {
  | ....
  | }
  | 
  | 
  | @Entity
  | @Table(name = "extendedClass")
  | @PrimaryKeyJoinColumn(name="id_baseClass")
  | public class ExtendedClass extends BaseClass  {
  | 
  | ...
  | 
  |     @Embedded //@Transient works
  |     private EmbeddableClass embedded = null;
  | }
  | 
  | @Entity
  | @Table(name = "anotherExtendedClass")
  | @PrimaryKeyJoinColumn(name="id_baseClass")
  | public class AnotherExtendedClass extends BaseClass  {
  | 
  | ...
  | }
  | 
  | 
  | @Embeddable
  | public class EmbeddableClass implements Serializable {
  | 
  |     @Column
  |     private boolean aValue;
  | 
  |     @Column
  |     private boolean anotherValue;
  | 
  | }
  | 
  | @Entity
  | @Table(name = "users")
  | public class User extends SimpleUser implements Serializable {
  | 
  |     @OneToMany(mappedBy = "anotherEntity", cascade={CascadeType.ALL}, 
fetch=FetchType.LAZY)
  |     private Collection<BaseClass> baseClassCollection = new 
Vector<BaseClass>();
  | }
  | 
  | 

So when I keep the @Embedded-Annotation, I have all objects of the 
ExtendedClass, but none
of the AnotherExtendedClasses. Together with the @Transient-annotation, I 
receive all entities
of all inherited-classes from the database.

Anyone having an idea, why this is not working?

Thanks
Thomas



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124429#4124429

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124429
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to