0
하나의 onetoMany 관계 코드 만 사용하면 정상적으로 작동합니다. 엔티티에서 1 @onetomany 관계가 더 이상 선언 될 때 org.hibernate.exception.SQLGrammarException : '필드 목록'에 'userregist0_.jdoDetachedState'알 수없는 열이 것을 관리 할 수있는 방법 내 엔티티 클래스는 package com.bullbeardevice입니다. .모델;Google App Engine에서 최대 절전 모드로 엔티티 relatinships를 관리하는 방법
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* The persistent class for the user_registration database table.
*
*/
@Entity
@Table(name = "user_registration")
@NamedQuery(name = "UserRegistration.findAll", query = "SELECT u FROM UserRegistration u")
@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="false")
public class UserRegistration implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_Registration_Id")
private String userRegistrationId;
@Column(name = "account_Status")
private int accountStatus;
@Column(name = "created_By")
private String createdBy;
@Column(name = "created_On")
@Temporal(TemporalType.TIMESTAMP)
private Date createdOn;
@Column(name = "email_Address")
private String emailAddress;
@Column(name = "expiry_Date")
@Temporal(TemporalType.TIMESTAMP)
private Date expiryDate;
@ManyToOne
@JoinColumn(name = "Group_Master_Id")
private GroupMaster groupMaster;
@Column(name = "modified_By")
private String modifiedBy;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "modified_On")
private Date modifiedOn;
@Column(name = "user_password")
private String password;
@Column(name = "permissions")
private int permissions;
// bi-directional many-to-one association to Chat
@OneToMany(mappedBy = "userRegistration")
private List<Chat> chats;
// bi-directional many-to-one association to Coupon
@OneToMany(mappedBy = "userRegistration")
private List<Coupon> coupons;
// bi-directional many-to-one association to DeviceDetail
@OneToMany(mappedBy = "userRegistration")
private List<DeviceDetail> deviceDetails;
// bi-directional many-to-one association to Portfolio
@OneToMany(mappedBy = "userRegistration")
private List<Portfolio> portfolios;
// bi-directional many-to-one association to UserDetail
@OneToMany(mappedBy = "userRegistration")
private List<UserDetail> userDetails;
// bi-directional many-to-one association to UserLoginDetail
@OneToMany(mappedBy = "userRegistration")
private List<UserLoginDetail> userLoginDetails;
// bi-directional many-to-one association to UserRoleMaster
@ManyToOne
@JoinColumn(name = "User_Role_Master_Id")
private UserRoleMaster userRoleMaster;
// bi-directional many-to-one association to Watch
@OneToMany(mappedBy = "userRegistration")
private List<Watch> watches;
public UserRegistration() {
}
/**
* @return the userRegistrationId
*/
public String getUserRegistrationId() {
return userRegistrationId;
}
/**
* @param userRegistrationId
* the userRegistrationId to set
*/
public void setUserRegistrationId(String userRegistrationId) {
this.userRegistrationId = userRegistrationId;
}
/**
* @return the accountStatus
*/
public int getAccountStatus() {
return accountStatus;
}
/**
* @param accountStatus
* the accountStatus to set
*/
public void setAccountStatus(int accountStatus) {
this.accountStatus = accountStatus;
}
/**
* @return the createdBy
*/
public String getCreatedBy() {
return createdBy;
}
/**
* @param createdBy
* the createdBy to set
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* @return the createdOn
*/
public Date getCreatedOn() {
return createdOn;
}
/**
* @param createdOn
* the createdOn to set
*/
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
/**
* @return the emailAddress
*/
public String getEmailAddress() {
return emailAddress;
}
/**
* @param emailAddress
* the emailAddress to set
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
/**
* @return the expiryDate
*/
public Date getExpiryDate() {
return expiryDate;
}
/**
* @param expiryDate
* the expiryDate to set
*/
public void setExpiryDate(Date expiryDate) {
this.expiryDate = expiryDate;
}
/**
* @return the groupMaster
*/
public GroupMaster getGroupMaster() {
return groupMaster;
}
/**
* @param groupMaster
* the groupMaster to set
*/
public void setGroupMaster(GroupMaster groupMaster) {
this.groupMaster = groupMaster;
}
/**
* @return the modifiedBy
*/
public String getModifiedBy() {
return modifiedBy;
}
/**
* @param modifiedBy
* the modifiedBy to set
*/
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
/**
* @return the modifiedOn
*/
public Date getModifiedOn() {
return modifiedOn;
}
/**
* @param modifiedOn
* the modifiedOn to set
*/
public void setModifiedOn(Date modifiedOn) {
this.modifiedOn = modifiedOn;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password
* the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the permissions
*/
public int getPermissions() {
return permissions;
}
/**
* @param permissions
* the permissions to set
*/
public void setPermissions(int permissions) {
this.permissions = permissions;
}
/**
* @return the chats
*/
public List<Chat> getChats() {
return chats;
}
/**
* @param chats
* the chats to set
*/
public void setChats(List<Chat> chats) {
this.chats = chats;
}
public Chat addChat(Chat chat) {
getChats().add(chat);
chat.setUserRegistration(this);
return chat;
}
public Chat removeChat(Chat chat) {
getChats().remove(chat);
chat.setUserRegistration(null);
return chat;
}
public List<Coupon> getCoupons() {
return this.coupons;
}
public void setCoupons(List<Coupon> coupons) {
this.coupons = coupons;
}
public Coupon addCoupon(Coupon coupon) {
getCoupons().add(coupon);
coupon.setUserRegistration(this);
return coupon;
}
public Coupon removeCoupon(Coupon coupon) {
getCoupons().remove(coupon);
coupon.setUserRegistration(null);
return coupon;
}
public List<DeviceDetail> getDeviceDetails() {
return this.deviceDetails;
}
public void setDeviceDetails(List<DeviceDetail> deviceDetails) {
this.deviceDetails = deviceDetails;
}
public DeviceDetail addDeviceDetail(DeviceDetail deviceDetail) {
getDeviceDetails().add(deviceDetail);
deviceDetail.setUserRegistration(this);
return deviceDetail;
}
public DeviceDetail removeDeviceDetail(DeviceDetail deviceDetail) {
getDeviceDetails().remove(deviceDetail);
deviceDetail.setUserRegistration(null);
return deviceDetail;
}
public List<Portfolio> getPortfolios() {
return this.portfolios;
}
public void setPortfolios(List<Portfolio> portfolios) {
this.portfolios = portfolios;
}
public Portfolio addPortfolio(Portfolio portfolio) {
getPortfolios().add(portfolio);
portfolio.setUserRegistration(this);
return portfolio;
}
public Portfolio removePortfolio(Portfolio portfolio) {
getPortfolios().remove(portfolio);
portfolio.setUserRegistration(null);
return portfolio;
}
public List<UserDetail> getUserDetails() {
return this.userDetails;
}
public void setUserDetails(List<UserDetail> userDetails) {
this.userDetails = userDetails;
}
public UserDetail addUserDetail(UserDetail userDetail) {
getUserDetails().add(userDetail);
userDetail.setUserRegistration(this);
return userDetail;
}
public UserDetail removeUserDetail(UserDetail userDetail) {
getUserDetails().remove(userDetail);
userDetail.setUserRegistration(null);
return userDetail;
}
public List<UserLoginDetail> getUserLoginDetails() {
return this.userLoginDetails;
}
public void setUserLoginDetails(List<UserLoginDetail> userLoginDetails) {
this.userLoginDetails = userLoginDetails;
}
public UserLoginDetail addUserLoginDetail(UserLoginDetail userLoginDetail) {
getUserLoginDetails().add(userLoginDetail);
userLoginDetail.setUserRegistration(this);
return userLoginDetail;
}
public UserLoginDetail removeUserLoginDetail(UserLoginDetail userLoginDetail) {
getUserLoginDetails().remove(userLoginDetail);
userLoginDetail.setUserRegistration(null);
return userLoginDetail;
}
public UserRoleMaster getUserRoleMaster() {
return this.userRoleMaster;
}
public void setUserRoleMaster(UserRoleMaster userRoleMaster) {
this.userRoleMaster = userRoleMaster;
}
public List<Watch> getWatches() {
return this.watches;
}
public void setWatches(List<Watch> watches) {
this.watches = watches;
}
public Watch addWatch(Watch watch) {
getWatches().add(watch);
watch.setUserRegistration(this);
return watch;
}
public Watch removeWatch(Watch watch) {
getWatches().remove(watch);
watch.setUserRegistration(null);
return watch;
}
}
도와주세요. 미리 감사드립니다!
왜 당신은 당신이 Hibernate를 사용한다고 말할 때 JDO 어노테이션을 사용하고 있습니까? –
나는 Hibernate 세션 팩토리와 트랜잭션 관리자를 사용하고있다. 그 문제를 생각하니? 그러나 내 프로젝트가 maven 프로젝트 일 경우에만이 예외가 발생하고 동적 웹 프로젝트가 제대로 작동하는 것으로 알고 있습니다. 나는 왜 그런지 알지 못한다. 어떤 생각이 ..? – Archit
사용중인 정의 : Google Cloud SQL? 이 경우에는 Hibernate를 사용하는 것이 좋다. 기본 AppEngine을 사용하고 있다면 Hibernate를 사용할 수 없습니다. 어쨌든 언급 한 주석을 삭제하십시오 ... JPA를 사용 중이며 JPA가 아니라고 말합니다. –