以下行返回空值:
List accountList = hibernateTemplate.find("from Accounts a where a.userId=?",userId);
我在控制台中得到以下信息:
2013-04-03 21:09:48 调试加载器:1197 - 结果行:空
2013-04-03 21:09:48 调试加载器:1197 - 结果行:空
这是我的实体类:
@Repository
@Entity
@Table(name = "ACCOUNTS")
public class Accounts {
@Column(name="ACCOUNT_ID")
@Id
@GeneratedValue
private int accountId;
@Column(name="ACCOUNT_NUMBER")
private String accountNumber;
@Column(name="ACCOUNT_TYPE_CODE")
private String accountTypeCode;
@Column(name="USER_ID")
private String userId;
@Column(name="ACCOUNT_NAME")
private String accountName;
@Column(name="DATE_OPENED")
private Date dateOpened;
@Column(name="DATE_CLOSED")
private Date dateClosed;
@Column(name="CURRENT_BALANCE")
private double currentBalance;
@Column(name="OTHER_ACCOUNT_DETAILS")
private String otherAccountDetails;
@Column(name="ADD_TS")
private Date addTimestamp;
@Column(name="ADD_USR")
private String addUser;
@Column(name="UPDT_TS")
private Date updateTimestamp;
@Column(name="UPDT_USR")
private String updateUser;
@ManyToOne
private Customer customer;
谁能帮我解决这个问题?我真的很感激。
这是 Hibernate 生成的查询
Hibernate: select accounts0_.ACCOUNT_ID as ACCOUNT1_23_, accounts0_.ACCOUNT_NAME as ACCOUNT2_23_, accounts0_.ACCOUNT_NUMBER as ACCOUNT3_23_, accounts0_.ACCOUNT_TYPE_CODE as ACCOUNT4_23_, accounts0_.ADD_TS as ADD5_23_, accounts0_.ADD_USR as ADD6_23_, accounts0_.CURRENT_BALANCE as CURRENT7_23_, accounts0_.customer_CUSTOMER_ID as customer14_23_ ,account0_.DATE_CLOSED 作为 DATE8_23_,accounts0_.DATE_OPENED 作为 DATE9_23_,accounts0_.OTHER_ACCOUNT_DETAILS 作为 OTHER10_23_,accounts0_.UPDT_TS 作为 UPDT11_23_,accounts0_.UPDT_USR 作为 UPDT12_23_,account0_.USER_ID 作为 USER13_23_ 从 ACCOUNT_ID=?
查询有问题吗?或域配置?
请帮我。