public int getAllCount() throws Exception {
int count = 0;
String hql = "SELECT COUNT(p.id) from Person AS p";
Query q = this.getSession().createQuery(hql);
List all = q.list();
if (all.size() > 0) {
count = (Integer) all.get(0);
}
return count;
} public int getByLikeCount(String cond) throws Exception {
int count = 0;
String hql = "SELECT COUNT(p.id) from Person AS p WHERE p.uid LIKE ? OR p.name LIKE ?";
Query q = this.getSession().createQuery(hql);
q.setString(0, "%" + cond + "%");
q.setString(1, "%" + cond + "%");
List all = q.list();
if (all.size() > 0) {
count = (Integer) all.get(0);
}
return count;
} public List queryAll(int currentPage, int lineSize) throws Exception {
List<Person> all = new ArrayList<Person>();
String hql = "FROM Person AS p";
Query q = this.getSession().createQuery(hql);
q.setFirstResult((currentPage - 1) * lineSize);
q.setMaxResults(lineSize);
all = q.list();
return all;
} public List queryByLike(String cond, int currentPage, int lineSize)
throws Exception {
List<Person> all = new ArrayList<Person>();
String hql = "FROM Person AS p WHERE p.uid LIKE ? OR p.name LIKE ?";
Query q = this.getSession().createQuery(hql);
q.setString(0, "%" + cond + "%");
q.setString(1, "%" + cond + "%");
q.setFirstResult((currentPage - 1) * lineSize);
q.setMaxResults(lineSize);
all = q.list();
return all;
}把上面mysql分页的代码怎么转成orcal中的呀
int count = 0;
String hql = "SELECT COUNT(p.id) from Person AS p";
Query q = this.getSession().createQuery(hql);
List all = q.list();
if (all.size() > 0) {
count = (Integer) all.get(0);
}
return count;
} public int getByLikeCount(String cond) throws Exception {
int count = 0;
String hql = "SELECT COUNT(p.id) from Person AS p WHERE p.uid LIKE ? OR p.name LIKE ?";
Query q = this.getSession().createQuery(hql);
q.setString(0, "%" + cond + "%");
q.setString(1, "%" + cond + "%");
List all = q.list();
if (all.size() > 0) {
count = (Integer) all.get(0);
}
return count;
} public List queryAll(int currentPage, int lineSize) throws Exception {
List<Person> all = new ArrayList<Person>();
String hql = "FROM Person AS p";
Query q = this.getSession().createQuery(hql);
q.setFirstResult((currentPage - 1) * lineSize);
q.setMaxResults(lineSize);
all = q.list();
return all;
} public List queryByLike(String cond, int currentPage, int lineSize)
throws Exception {
List<Person> all = new ArrayList<Person>();
String hql = "FROM Person AS p WHERE p.uid LIKE ? OR p.name LIKE ?";
Query q = this.getSession().createQuery(hql);
q.setString(0, "%" + cond + "%");
q.setString(1, "%" + cond + "%");
q.setFirstResult((currentPage - 1) * lineSize);
q.setMaxResults(lineSize);
all = q.list();
return all;
}把上面mysql分页的代码怎么转成orcal中的呀
解决方案 »
- Oracle存储过程并发
- 如何将一表空间的数据导入另一表空间
- oracle sqlldr时的log能不能追加,不重写???
- WMSYS.WM_CONCAT函数结果类型自动转化问题
- ORA-27046: file size is not a multiple of logical block size急救!在线等
- dbms_job自动任务可以在directory内写文件,但是手动执行任务的过程却提示无法写文件。
- oracle job时间间隔问题
- 高分求救exp导出数据问题
- SQLPLUS中如何显示变量的值
- 如何设计某个帐号只能允许一个人同时使用
- oracle 插入不了数据,数据游离,但在页面能看到插入的数据
- 商用J2EE项目,一个对数据库设计很奇异的问题
你这不是java代码吗?怎么换才plsql啊,你说点业务逻辑吧,一堆java代码,我们也不好猜啊,对吧?
SELECT * FROM
(SELECT rownum "SN.",row_.* FROM
(select * from tab)
row_ WHERE rownum <= 30)
WHERE "SN.">0