0
我试图访问条款使用的某些数据,但找到的数据可以 例外HQL查询使用条款
意外的标记:近线1,列81客户[从 应用.com.db.DTO.SmsSourceDTO短信其中sms.description在( 注册客户,外部DB,生日)]
显示
SmsSourceDTO.java
@Table(name = "sms_source_tbl")
public class SmsSourceDTO implements Serializable {
private Integer id;
private String description;
}
。
TestHql.java
listOfSelectedDatabase = {Registered Customer,External DB,Birthday};
String hqlString = "from SmsSourceDTO as sms where sms.description in(" + listOfSelectedDatabase +")";
getResultSetByHQL(hqlString));
protected List getResultSetByHQL(String hql) throws DataBaseException {
Query query = null;
query = getHbSession().createQuery(hql);
session = null;
return query.list();
}
在调试时,我得到了下面的查询=>from SmsSourceDTO as sms where sms.description in (Registered Customer,External DB,Birthday)
任何人可以帮助。
后编译代码。在你的查询中使用参数,而不是连接:'smsSourceDTO as sms where sms.description in:list'。并且请不要将您的实体命名为“DTO”。 DTO是一个数据传输对象。 –