0
我正在重新編程應用程序。 當前數據庫具有像「User」這樣的表名,它是新數據庫中的保留字,所以我將表名更改爲「NewUser」。我還必須更改一些列名稱。我想代碼,以便它導入了新的名字,但在應用程序中回保留字立即改變他們,所以我沒有花很多時間重新編程的:從表中重命名JPA實體
示例代碼:
@Entity
// NewUser is the new table name but still User below. I would like to keep the user
//as the class name but go after NewUser in the db
public class User implements java.io.Serializable {
private static final long serialVersionUID = -6091824661950209090L;
/** Primary key */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
// uid is now newuid in the table but again I want to keep uid in the app
//but reference newuid from the db
protected int uid;
public int getUid() {
return this.uid;
}
public void setUid(int uid) {
this.uid = uid;
}