Announcement Announcement Module
Collapse
No announcement yet.
No identifier specified for entity Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No identifier specified for entity

    I got an error saying
    Code:
    org.hibernate.AnnotationException: No identifier specified for entity: MyEntity.
    when I deploy my roo generated war file to Tomcat 6.0.

    My project is using Spring 3.0 + Hibernate 3.4.

    but in MyEntity_Roo_Entity the code is as below:
    Code:
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id")
        private Long MyEntity.id;
        
        @Version
        @Column(name = "version")
        private Integer MyEntity.version;
        
        public Long MyEntity.getId() {
            return this.id;
        }
        
        public void MyEntity.setId(Long id) {
            this.id = id;
        }
    What is wrong with my code? The primary key has been defined in MyEntity.id. Why does it show that error?

  • #2
    There does not appear to be anything wrong in you what you have listed. You mentioned you are using Hibernate 3.4 and I have seen this problem before when mixed versions of Hibernate jars are used. Roo has used Hibernate 3.6.x for a while now so make sure that all the Hibernate jars in your classpath have exactly the same version number.
    Alan

    Comment


    • #3
      Thanks Alan I am also aware of that. But when I search the dependency in Eclipse the latest version of these two dependencies available is 3.4.0.GA.

      com.springsource.org.hibernate.annotations
      com.springsource.org.hibernate.ejb

      But I did notice that there are multiple but different versions of com.springsource.org.hibernate jar files in the lib folder of my Tomcat server.

      Comment

      Working...
      X