Skip to content
Advertisement

Does Hibernate allow writing of String/Type Safe SQL?

Does Hibernate allow the writing of String/Type SQL , similar to Entity Framework /w Linq, where a person can write proper Sql, and any misspelled SQL Table, Column names will be shown at compile time instead of run execution time?

JavaScript

Advertisement

Answer

As requested I’m adding my comment as an answer.

Id depends on how you are creating your query, If you are using JPA/Native queries, no, if you are using criteria (with only entity objects), then yes.

Here is an example of using Criteria with just entity objects: https://stackoverflow.com/a/36648488/460557

Although if you are using Criteria APIs that you need to pass in Strings, then the answer is also no.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement