13.07.2015 Views

Hibernate Query Language Hibernate Query Language and Native

Hibernate Query Language Hibernate Query Language and Native

Hibernate Query Language Hibernate Query Language and Native

SHOW MORE
SHOW LESS

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!