JPA mapping: “QuerySyntaxException: foobar is not mapped…”

前端 未结 4 1629
青春惊慌失措
青春惊慌失措 2020-12-04 11:02

I\'ve been playing around with a very simple JPA example and am trying to tweak it to an existing database. But I can\'t get past this error. (Below.) It just has to be s

4条回答
  •  清歌不尽
    2020-12-04 11:53

    I got the same error while using other one entity, He was annotating the class wrongly by using the table name inside the @Entity annotation without using the @Table annotation

    The correct format should be

    @Entity //default name similar to class name 'FooBar' OR @Entity( name = "foobar" ) for differnt entity name
    @Table( name = "foobar" ) // Table name 
    public class FooBar{
    

提交回复
热议问题