拼接SQL或者hql的方式优劣谈论
名白 2017-05-05 04:23:58 下边两种拼字符串的方式,哪种更好一些,或者还有更好的方式?
StringBuffer hql=new StringBuffer();
hql.append("from ChoiceStorages where id=");
hql.append(subjectId);
//String hql="from ChoiceStorages where id="+subjectId;
Query query = sessionFactory.getCurrentSession().createQuery(hql.toString());