valuelist 를 분리 하 는 sql 패키지
3178 단어 동적 sql 조립
//jap 의
//hibenate 의
//이 프로필 은 있어 야 합 니 다.
${hibernate.dialect}
@Autowired
public Hibernate4Adapter hibernate4Adapter;
@Autowired
private JdbcAdapter jdbcAdapter;
@Test
public void jdbc(){
try {
String sql = "select * from inspur_topic where 1=1 " +
"/~name: and name = {name}~/" +
"/~name: and name = '[name]'~/" +
"/~sortColumn: order by [sortColumn] [sortDirection]~/";
HashMap filters = new HashMap();
filters.put("sortColumn", "id");
filters.put("pagingNumberPer", "2");
filters.put("sortDirection", "desc");
filters.put("pagingPage", "1");
filters.put("name", " ");
net.mlw.vlh.ValueListInfo info = new net.mlw.vlh.ValueListInfo(filters);
ValueList valueList = jdbcAdapter.getValueList(sql, info);
System.err.println(valueList.getList().size());
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void hibernate(){
try {
String hql = "from topic where 1=1 " +
"/~name: and name = {name}~/" +
"/~name: and name = '[name]'~/" +
"/~sortColumn: order by [sortColumn] [sortDirection]~/";
HashMap filters = new HashMap();
filters.put("sortColumn", "id");
filters.put("pagingNumberPer", "2");
filters.put("sortDirection", "desc");
filters.put("pagingPage", "1");
filters.put("name", " ");
net.mlw.vlh.ValueListInfo info = new net.mlw.vlh.ValueListInfo(filters);
ValueList valueList = hibernate4Adapter.getValueList(hql, info);
System.err.println(valueList.getList().size());
} catch (Exception e) {
e.printStackTrace();
}
}
모 르 는 집단 이 함께 토론 하 다.