Hibernate Query Language Hibernate Query Language and Native
Hibernate Query Language Hibernate Query Language and Native
Hibernate Query Language Hibernate Query Language and Native
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Setting Fetch Size// retrieve initial page, up to 50 records<strong>Query</strong> getAccountsPage1 =session.create<strong>Query</strong>("from Account").setMaxResult(50).setFetchSize(50);...// retrieve subsequent pages, passing// in the first record to start with<strong>Query</strong> getAccountsNextPage =session.create<strong>Query</strong>("from Account").setFirstResult(:startingIndex).setMaxResult(50).setFetchSize(50);Adding Comments to <strong>Query</strong>• Developer provided commentsincluded in the log along with the<strong>Hibernate</strong> SQL statement– setComment(String comment);– Need to enable 'user_sql_comments' in the<strong>Hibernate</strong> configurationi• Assists in distinguishing user-generated queries vs. <strong>Hibernate</strong>generated– Also be used to explain query intentioni