在Hibernate中,可以使用以下方法来限制结果查询: 1. setMaxResults(int maxResults):设置查询结果的最大数量。 2. setFirstResult(int firstResult):设置查询结果的起始位置。 3. setFetchSize(int fetchSize):设置每次从数据库中获取的记录数。 4. setFetchMode(String associationPath, FetchMode mode):设置关联实体的获取模式。 例如,以下代码将限制查询结果的数量为10,并从第5个结果开始返回: ``` Query query = session.createQuery("from User"); query.setMaxResults(10); query.setFirstResult(5); List<User> users = query.list(); ``` 注意:setMaxResults和setFirstResult方法只对list和scroll方法有效。如果使用uniqueResult方法,则不会受到这些限制。