jpa error uses a non-entity [class ch.printsoft.mailhouse.usermgr.entity.Department] as target entity in the relationship attribute

前端 未结 8 692
北海茫月
北海茫月 2020-12-18 19:17

I try to persist my Department and Mandator classes to hsqhldb but it gives this error.

Exception Description: [class ch.printsoft.         


        
8条回答
  •  粉色の甜心
    2020-12-18 19:49

    Ensure you have both classes has the property of PK and the no parameter constructor. I add the following code in my entity class.

    @Entity
    public class EntityClass{
       @Id
       @GeneratedValue(strategy=GenerationType.AUTO)
       public int id;
       public EntityClass() {
       } 
       ...
    }
    

提交回复
热议问题