2

Is it possible (and if yes, is it advisable) to do queries of Hibernate-mapped data without using SQL-strings, but some OOP way instead?

3 Answers 3

7

use the Criteria API, more examples here.

Sign up to request clarification or add additional context in comments.

Comments

1

I am using linq. But HQL uses entities, so it should be named object-oriented :)

Comments

1

It's possible using Criteria, but I think the queries are generally more understandable when using HQL with parameters. Still, Criteria does work well for the queries that are quite dynamic (I've seen people concatenate HQL strings for dynamic queries, and Criteria is cleaner in those cases).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.