Olá,
Eu estou desenvolvendo uma aplicação em EJB3 (Jboss AS 4.02 JDK 1.6) com a única diferença em relação à outros projetos semelhantes que desenvolvi é que algumas entidades mapeadas via annotations estão em outro jar.
Uma delas tenho a classe DocumentImpl :
@Entity(name = "Document")
@DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.CHAR)
@DiscriminatorValue(value = "D")
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "T_DOCUMENT")
public abstract class DocumentImpl implements Document
{
/**
* Getter for property number.
*
* @return Value of property number.
*
*/
@Override
@Id
@Column(unique=true,nullable=false, length=64)
public String getNumber()
{
return this.number;
}
@Override
public void setNumber(String number)
{
this.number = number;
}
....
}
E uma das classes filhas possui a seguinte estrutura :
@Entity(name = "CNPJ")
@DiscriminatorValue(value = "C")
@Table(name = "T_CNPJ_PT_BR")
public final class CNPJImpl extends DocumentImpl implements CNPJ
{
...
}
Ao efetuar o deploy aparece o seguinte warning no console do jboss para cada classe filha de DocumentImpl :
WARN [AnnotationBinder] Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: br.com.loja.util.entity.document.br.impl.CNPJImpl
E o deploy evidentemente falha, com o seguinte erro :
12:04:41,456 INFO [AnnotationBinder] Binding entity from annotated class: br.com.loja.util.entity.document.impl.DocumentImpl
12:04:41,456 INFO [EntityBinder] Bind entity br.com.loja.util.entity.document.impl.DocumentImpl on table DocumentImpl
12:04:41,458 WARN [ServiceController] Problem starting service persistence.units:ear=shop-ear-1.0.ear,jar=shop-ejbs-1.0.jar,unitName=shop
org.hibernate.AnnotationException: No identifier specified for entity: br.com.loja.util.entity.document.impl.DocumentImpl
…
Reason: org.hibernate.AnnotationException: No identifier specified for entity: br.com.loja.util.entity.document.impl.DocumentImpl
Simplesmente não tenho a menor idéia o porque ele não está reconhecendo o Id e nem obedecendo a diretiva @Table de DocumentImpl ( Bind entity br.com.loja.util.entity.document.impl.DocumentImpl on table DocumentImpl)
Inclusive eu inclui a referencia ao jar onde está DocumentImpl dentro do persistence.xml, porém nada adiantou :
…/business-entities-1.0.jar
Alguém já passou por este problema alguma vez ou teve algum erro semelhante?