Results 1 to 3 of 3

Thread: No identifier specified for entity

  1. #1

    Default 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. #2
    Join Date
    Dec 2005
    Posts
    929

    Default

    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
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •