你是要將陣列中的值寫到hql中嗎?
可以用迴圈拼接字串和佔位符插入進去
Object[] parameter = null;
StringBuffer hql1=new StringBuffer();
hql1.append("from BlogCategory ");
if(CId!=null){
length=CId.size();
parameter=new Object[length];
for(int a=0;a
Session session = sessionFactory.openSession();
Query query = session.createQuery(hql);
if (parameter != null) {
for (int a = 0; a
if (parameter[a] != null) {
query.setParameter(a, parameter[a]);
}
@SuppressWarnings("unchecked")
List
session.close();
return blogCategoryList;
你是要將陣列中的值寫到hql中嗎?
可以用迴圈拼接字串和佔位符插入進去
Object[] parameter = null;
StringBuffer hql1=new StringBuffer();
hql1.append("from BlogCategory ");
if(CId!=null){
length=CId.size();
parameter=new Object[length];
for(int a=0;a
Session session = sessionFactory.openSession();
Query query = session.createQuery(hql);
if (parameter != null) {
for (int a = 0; a
if (parameter[a] != null) {
query.setParameter(a, parameter[a]);
}
}
}
@SuppressWarnings("unchecked")
List
session.close();
return blogCategoryList;