-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problems usging @@EmbeddableSuperclass in PAR files on JBoss
PostPosted: Sat Aug 13, 2005 4:13 pm 
Beginner
Beginner

Joined: Wed Jan 21, 2004 10:52 pm
Posts: 27
Location: Santa Cruz do Sul - RS - Brazil
Hi all,
Im using jboss 403rc1 and trying to deploy my ear file (with a PAR file).
The problem occurs with @EmbeddableSuperclass...
I'm using this annotation to inherit ID (and others) properties...like described in EJB3 specification of Jun 25, 2005.

My classes are:

Code:
//Provide ID and audit fields to all classes
@EmbeddableSuperclass(access=javax.persistence.AccessType.PROPERTY)
public abstract class Persistente implements Serializable {
   
   protected Long id;
   protected Date insertDate;
   protected Date updateDate;
   protected String user;
   protected Integer version;

   @Id(generate = GeneratorType.AUTO)
   public Long getId() {
      return id;
   }

   //getters and setters with tags...
}

//Provide basic fields to a group of similar classes...
@EmbeddableSuperclass
public abstract class BaseBean extends Persistente {

   protected String nome;
   protected String descricao;

   //getters and setters with tags...
}

//Represent an element in access control
@Entity
@Inheritance(strategy = javax.persistence.InheritanceType.JOINED)
@Table(name="IntegranteGu3L")   
public abstract class Integrante extends BaseBean {

   protected String email;
   protected List<Grupo> grupos; //inverse collection of Grupo.integrantes

   //getters and setters with tags...
}

//Represent an user in access control
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "UsuarioGu3L")
public class Usuario extends Integrante {

   protected String password;

   //getters and setters with tags...
}

//Represent a group of "Integrante" in access control
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "GrupoGu3L")
public class Grupo extends Integrante {

   protected List<Integrante> integrantes; //owner collection of Integrante.grupos

   //getters and setters with tags...
}



When I deploy the package (EAR with a PAR file), the error is:

Code:
No identifier specified for entity: Integrante


Well, to resolve this problem, I override "getId" in Integrante, like this:
Code:
//Represent an element in access control
@Entity
@Inheritance(strategy = javax.persistence.InheritanceType.JOINED)
@Table(name="IntegranteGu3L")   
public abstract class Integrante extends BaseBean {

   protected String email;
   protected List<Grupo> grupos; //inverse collection of Grupo.integrantes

   @Id(generate = GeneratorType.AUTO)
   public Long getId() {
      return id;
   }

   //getters and setters with tags...
}


So, the problem of ID property was solved, but my question is? I NEED override "getId" in all (sub)classes?...

In the same form, when execute a HQL query, like:
Code:
SELECT u.nome FROM Usuario u


The hibernate report that "Usuario" does not have "nome" property...

What it is? And @EmbeddableSuperclass?

Reading posts in forum, I see it:

1) http://forum.hibernate.org/viewtopic.ph ... highlight=
2) http://forum.hibernate.org/viewtopic.ph ... hlight=3+1

But, the problem "persists"...

_________________
Do you still create DTO factories? Oh, no!
Try DTOptimzier now!
https://dtoptimizer.dev.java.net/


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 6:55 pm 
Beginner
Beginner

Joined: Thu Mar 31, 2005 9:58 pm
Posts: 25
Location: Valparaiso
Hi rocket, i have the same problem. The solution is override all inherited methods in the embaddable subclasses. This look like a bug(?) of hibernate... see this post:

http://forum.hibernate.org/viewtopic.ph ... highlight=


i hope this help you,

_________________
Daniel Casanueva R.

Jcode
Valparaiso, Chile


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 8:04 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Daniel is wrong, the problem is not related.

I'm very skeptical since I have a unit test that cover this kind of use case.

_________________
Emmanuel


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