1 Reply Latest reply on Nov 28, 2005 1:50 PM by epbernard

    EJB3 org.Hibernate.AnnotationException.

    alvarommz

      Hi,

      I wish to know how could I solve the following AnnotationException posted at deployment stage of my application:

      [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=XCellDomain.par

      org.hibernate.AnnotationException: referencedColumnNames(cdmn_ciudades.codciud) of com.aemm.celldomn.entity.OEmpresa.emprCiudad referencing com.aemm.celldomn.entity.OCiudad not mapped to a single property


      at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:150)
      at org.hibernate.cfg.AnnotationBinder.bindFkSecondPass(AnnotationBinder.java:1640)
      at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:32)
      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:214)
      at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:988)
      at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:607)
      at.....


      The scenario is as follows:

      The OEmpresa entity:

      @Entity
      @Table(name="cdmn_Empresas", schema= "CellDom")
      public class OEmpresa extends CEJB3Validator implements Serializable
      {
       private long emprId;
       ...
       private OCiudad emprCiudad;
       ...
       ...
      
      
       @ManyToOne(targetEntity = com.aemm.celldomn.entity.OCiudad.class)
       @JoinColumn(name="cdmn_empresas.codciud",
       referencedColumnName="cdmn_ciudades.codciud")
       public OCiudad getEmprCiudad()
       {
       return this.emprCiudad;
       }
      
       public void setEmprCiudad(OCiudad emprCiudad)
       {
       this.emprCiudad = emprCiudad;
       }
      }
      


      cdmn_empresas : the table for OEmpresa and codciud a column referencing the Id of OCiudad

      cdmn_ciudades : the table for OCiudad and codciud is it´s PK

      The OCiudad Entity:

      @Entity
      @Table(name="cdmn_Ciudades", schema= "CellDom")
      public class OCiudad implements Serializable
      {
       private long CodCiud;
       private String NomCiud;
       private String DptoProv;
       ...
       @Id(generate=GeneratorType.NONE)
       @Column(name="CodCiud", nullable = false )
       public long getCodCiud()
       {
       return this.CodCiud;
       }
      
       public void setCodCiud(long codCiud)
       {
       this.CodCiud = codCiud;
       }
      



      thanks in advance for your help.

      Alvaro Martinez
      alvarommz@yahoo.com