1 Reply Latest reply on Apr 8, 2008 4:32 PM by christian.bauer

    Not evaluated @Column Annotation

    fermat

      Hello,


      I am using SEAM 2.0.1 on a JBoss 4.2.2 with EJB3 and PostgreSQL 8.2.6. I generated a project using seam-gen and added an entity containing a field physicalDiskId. By a Column-Annotation this field is mapped to a column physicalvolume_id. Here the been:


      @Entity
      @IdClass(ExtentPK.class)
      @Table(name="extent")
      public class Extent implements java.io.Serializable {
          
           private static final long serialVersionUID = 1L;
      
           // <editor-fold defaultstate="collapsed" desc="EJB CMP Fields.">
          @Id
          @Column(name = "id", nullable = false)
          private Long id;
          
          @Id
          @Column(name = "physicalvolume_id", nullable = false)
          private Long physicalDiskId;
          
          @Column(name="virtualposition")
          private Long virtualPosition;
          
          @Column(name="physicalposition")
          private Long physicalPosition;
          
          @Column(name="status")
          private Long status;
          
          @Column(name="virtualvolume_id")
          private Long virtualVolumeId;
      
      [...]
      



      Deploying the application I get the following errormessage:


      15:37:13,075 WARN  [ServiceController] Problem starting service persistence.units:ear=mda2008.ear,jar=mda2008.jar,unitName=mda2008
      javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing column: physicalDiskId in public.extent
           at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
           at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
      



      So it tries to find a column named after the field in the bean instead of the name I told him. Why does this happen?


      The table extent looks like following:


      CREATE TABLE extent (
              id bigint,
              physicalvolume_id bigint,
              virtualposition bigint,
              physicalposition bigint,
              status bigint,
              virtualvolume_id bigint,
              PRIMARY KEY (id, physicalvolume_id)
      );
      



      Can anyone tell me where my failure is?


      bests


      Sascha