私は休止状態になっています。私はMySQLでHibernateを使用してデータを永続化しました。ここに私のEntityクラスがあります。Session.getはステップバイステップデバッグで動作していますが、eclipseで動作している間は動作しません。
@Entity
@XmlRootElement
public class SecuredCustomer implements Serializable{
@Id
private String loginId;
private String password;
@Embedded
UserInfo userInformation = new UserInfo();
int allocatedRestaurantTableId;
@Embedded
Order order;
@Embedded
Bill bill;
public SecuredCustomer(){
allocatedRestaurantTableId = -1;
order = null;
bill = null;
}
public Bill getBill() {
return bill;
}
public void setBill(Bill bill) {
this.bill = bill;
}
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public int getAllocatedRestaurantTableId() {
return allocatedRestaurantTableId;
}
public void setAllocatedRestaurantTableId(int allocatedRestaurantTableId) {
this.allocatedRestaurantTableId = allocatedRestaurantTableId;
}
public UserInfo getUserInformation() {
return userInformation;
}
public void setUserInformation(UserInfo userInformation) {
this.getUserInformation().setAddress(userInformation.getAddress());
this.getUserInformation().setAge(userInformation.getAge());
this.getUserInformation().setName(userInformation.getName());
this.getUserInformation().setPhoneNumber(userInformation.getPhoneNumber());
}
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public boolean equals(Object obj)
{
return this == obj;
}
}
ユーザーがログインIDとパスワードでサインアップしている間、私はこのクラスを維持しています。
今私は、次のようなデータを取得しようとしています:以下のようにHibernateが作成
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
//Retrieving Data
Session session = sessionFactory.openSession();
session.beginTransaction();
SecuredCustomer customerInDB = session.get(SecuredCustomer.class, userLoginId);
SQLは次のとおりです。 休止:loginId1_11_0_、allocate2_11_0_としてsecuredcus0_.allocatedRestaurantTableId、securedcus0_としてsecuredcus0_.loginIdを選択します.totalとしてtotal3_11_0_、securedcus0_.password as password4_11_0_、securedcus0_.address as address5_11_0_、securedcus0_.age as age6_11_0_、securedcus0_.name as name7_11_0_、securedcus0_.phoneNumber as phoneNum8_11_0_ SecuredCustomer securedcus0_ここからsecuredcus0_.loginId =?
このSQL文は正常に動作しています。
私はステップバイステップデバッグで、データベースからデータを戻しています。 eclipse/tomcatで同じコードを実行している間は、オブジェクトがDBのテーブルで利用可能であってもnullオブジェクトを返します。 Ubuntuを実行しているローカルホストのWebアプリケーションをテストしています... 私を助けてください。 は...事前解決