Question about Hibernate requirement
Closed this issue · 5 comments
Hi - sorry to log this as an issue, this is just a question. In the README it says "without any other generated classed based on database schema". Do you mean that it does not require JPA classes or hibernate.cfg.xml
? I am looking for something like that.
No problem - very willing to answer any question :)
Yes - the NativeCriteria does not require the JPA classes. The requirement of hibernate dependency on dependencies list of NativeCriteria is dictated by the case that under the hood Native Criteria is using Hibernate Session#createSQLQuery to generate native SQL.
It helps to deal with some differences between databases engines out-of-the-box (like limit / offset which is different for Oracle / SQL Server / etc.) and do not disturb when somebody wants to use some db specific hints / syntax.
It was the idea behind the NativeCriteria. We had some project which was using a lot of JPA entities but in some cases we had also legacy tables (non JPA) and we needed complicated joins of both with dynamically generated criteria queries (and some names of those tables comes from internal metadata so the table name was also generated dynamically) and the NativeCriteria worked very well. The size of the db where the NativeCriteria was used is something between 0,5 - 1 TB (above 100 millions of documents).
Currently I'm working with two new modules for Native Criteria (version 2.0). First one is for Spring integration (in order to support that kind of stuff like Pageable from Spring, BeanPropertyMappers, etc.) and the second one with test and examples where will be used Spring Boot & Liquibase with some working use cases of NativeCriteria.
I hope that answer you question.
Awesome! Looking forward to checking it out. We want to be able to create criteria queries without needing to map the tables. Using the Hibernate Session and createSQLQuery sounds like a great idea.
Thanks!
You are welcome. If you need any improvements or features do not hesitate to create issue or pull request. Any input is appreciate!
@sourcedelica you could take a look at new module nativeCriteria-test. There are examples with Spring Boot & Liquibase. For example you could test on "SUPPLIER" table which does not have the reference in JPA entity.
Thanks! I will check it out.
-- Eric
On Fri, Aug 7, 2015 at 8:57 AM, Przemek notifications@github.com wrote:
@sourcedelica https://github.com/sourcedelica you could take a look at
new module nativeCriteria-test. There are examples with Spring Boot &
Liquibase. For example you could test on "SUPPLIER" table which does not
have the reference in JPA entity.—
Reply to this email directly or view it on GitHub
#10 (comment)
.