English 中文(简体)
游乐框架: 未指定主要栏目为背书[封闭]的实体
原标题:Play Framework: Entity not having primary key column named id [closed]

我想利用现有数据库。 实体表有一个称为代码的栏目,用作主要钥匙。

Probably a simple annotation but I am new to Play Framework and JPA.

谢谢。

最佳回答

如果你是新来发挥作用的框架,实际上可能不是这样简单。

Play uses the Model class which extends GenericModel which in turn extends JPABase. The model class enhances the entity with it s own Id.

因此,如果贵实体拥有自己的主要钥匙,它就会扩大通用模型,并将主要钥匙与......d:

public class MyEntity extends GenericModel {

   @Id
   public String code;

}
问题回答

暂无回答




相关问题
query must begin with SELECT or FROM: delete [delete

I am using JPA in addition to spring(3.0.0.M4). While deleting multiple records using query.executeUpdate() i am getting the following exception. org.springframework.web.util.NestedServletException: ...

Last update timestamp with JPA

I m playing around a bit with JPA(Eclipselink to be specific). The below entity have a timestamp that s supposed to reflect whenever that entity was last updated. What are the strategies for making ...

@IdClass with non primative @Id

I m trying to add a composite primary key to a class and having a bit of trouble. Here are the classes. class User { private long id; ... } class Token { private User user; private ...

Database not dropped in between unit test

Hello good people i came accross a weird behaviour in my test.I m using JPA hibernate annotation with spring. let say i have an Class MyObject and it s property email is marqued @Column(name="EMAIL", ...

Toplink trying to persist null object

I have an object "Instance" with another object "Course" inside. When trying to persist a new Instance object, I get the following error if Course is null: java.lang.IllegalStateException: During ...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

热门标签