query.setFirstResult(0),query.setMaxResults(1);相当于MySQL中的limit 0, 1;

String hql = "FROM Forum f WHERE f.position < ? ORDER BY f.position DESC";
        Query query = this.getSession().createQuery(hql);
        query.setParameter(0, p1);
        query.setFirstResult(0);
        query.setMaxResults(1);
        Forum forum2 = (Forum) query.uniqueResult();

alt + shift +a

query.setFirstResult(0),query.setMaxResults(4)的更多相关文章

  1. Hibernate中的query.setFirstResult(),query.setMaxResults();

    一.query.scroll()和query.setFirstResult(),query.setMaxResults();这两种方法都可以取到一定范围内的数据,用来数据分页显示.那么两者区别,以及两 ...

  2. Mybatis Dynamic Query 2.0.2

    项目地址:https://github.com/wz2cool/mybatis-dynamic-query 文档地址:https://wz2cool.gitbooks.io/mybatis-dynam ...

  3. Error:dijit.tree.TreeStoreModel:root query returned 0 items

    1.错误描述 error loading root:                                            Tree.js(第341行) Error:dijit.tre ...

  4. SRDC - ORA-1555: Query Duration 0: Checklist of Evidence to Supply (Doc ID 1682704.1)

    SRDC - ORA-1555: Query Duration 0: Checklist of Evidence to Supply (Doc ID 1682704.1) Action Plan 1. ...

  5. Elasticsearch 5.x 关于term query和match query的认识

    http://blog.csdn.net/yangwenbo214/article/details/54142786 一.基本情况 前言:term query和match query牵扯的东西比较多, ...

  6. Hibernate : Query.list()、Query.iterator()的区别

    Query上有list()与iterator()方法,两者的差别在于list()方法在读取数据时,并不会利用到快取,而是直接再向数据库查询,而iterator()则将读取到的数据写到快取,并于读取时再 ...

  7. Mybatis Dynamic Query 1.0.2版本

    项目地址:https://github.com/wz2cool/mybatis-dynamic-query 文档地址:https://wz2cool.gitbooks.io/mybatis-dynam ...

  8. Mybatis Dynamic Query 2.0 入门

    简介 2.0 昨天打包好了,主要是整合了tk.mybatis.mapper 到项目中去,所以和1.x比起来主要多了一个通用mapper.因为作者主要是使用springboot 这里讲一下Springb ...

  9. Yii 2.0 query模式语法

    项目使用Yii 2.0版本开发,个人一直喜好使用(new \yii\db\Query())模式操作数据,把增.删.查.改这4种情况的写法整理出来,方便查阅和记忆. 增加 - insert use Yi ...

随机推荐

  1. power coefficient calculation -- post processing

    input: unscaled moment of one bladeoutput: power coefficient of a 3-blades wind/tidal turbine matlab ...

  2. importdata-- matlab

    source file: test.dat *************************** Day1  Day2  Day3  Day4  Day5  Day6  Day795.01 76.2 ...

  3. 【Lqb T336】Cowboys

    [链接] 我是链接,点我呀:) [题意] 出现AB就要交换一下 给你结果序列 问你原序列有多少种可能 首尾可以交换. [题解] 设 dp[i][0]表示i和i-1不交换,达到前i个字符序列的状态的方案 ...

  4. HDU 2242 连通分量缩点+树形dp

    题目大意是: 所有点在一个连通图上,希望去掉一条边得到两个连通图,且两个图上所有点的权值的差最小,如果没有割边,则输出impossible 这道题需要先利用tarjan算法将在同一连通分量中的点缩成一 ...

  5. [luoguP2890] [USACO07OPEN]便宜的回文Cheapest Palindrome(DP)

    传送门 f[i][j] 表示区间 i 到 j 变为回文串所需最小费用 1.s[i] == s[j] f[i][j] = f[i + 1][j - 1] 2.s[i] != s[j] f[i][j] = ...

  6. android调试

    要进行调试,首先构建app的时候必须选择是Debug模式,而不能是Release模式. 接下来的内容转载自: http://www.cnblogs.com/gaoteng/p/5711314.html ...

  7. Maticsoft Code Generator

    源码:https://github.com/easonjim/MaticsoftCodeGenerator bug提交:https://github.com/easonjim/MaticsoftCod ...

  8. MyBatis3-示例工程

    一.准备工作: 0.新建QuitStart类型POM项目(即Application),Java Build Path为JDK1.8,Java Compiler为1.8,MySQL为5.5.38,数据库 ...

  9. docker: 定时检查docker container的运行状态并发邮件报警

    首先创建一个发送邮件的bash脚本 - send_mail.sh: #!/bin/bash curl -s --user 'api:key-xxxxxxxxxxxxx' \ https://api.m ...

  10. [Mini Programe] Upload Images

    Code for upload iamges: chooseImage: choose the images to upload previewImage: preview the image and ...