org.hibernate.AnnotationException: No identifier specified for entity - even when it was

前端 未结 3 1869

I have the following configuration:



        
相关标签:
3条回答
  • 2020-12-14 00:38

    I had the following

    import org.springframework.data.annotation.Id;
    

    Naturally, it should be:

    import javax.persistence.Id;
    

    Thanks to @JB Nizet

    0 讨论(0)
  • 2020-12-14 00:43

    try this

      @Column(name="geonameid",unique=true,nullable=false)
    
    0 讨论(0)
  • 2020-12-14 00:52

    I faced the same error.I solved it and figured out i didn't put @Id annotations in id field in my Entity class.

    @Entity
    @Table(name="geonames")
    public class Geoname implements Serializable {
    
        @Column(name="geonameid")
        private Long geonameid = null;
    }
    
    0 讨论(0)
提交回复
热议问题