tags:

views:

188

answers:

2

Hello everybody,

I working on a project with Hibernate and we need to replace Hibernate with some "home made persistence" stuff. The idea is that the project is big enough, and we have many HQL queries. The problem is with the queries like

select a,b from table1, table2 on t1.table1=t2.table2

Basically all joins are not supported by our "hand made persistence" stuff.

What I would need, is to be able to do some sort of transcoder, which will take as a input the HQL queries and output some SQL, but SQL without joins

I hope you get the idea. My persistence layer does not supports joins.

Does anybody has any idea about something like that? Some framework, or something?

Thanks alot everybody.

C.C.

A: 

You can't do what that example HQL is doing without a JOIN of some sort. What you can do is implement the joins in a View and then use your home grown stuff to query the view. That insulates you from the implementation of the joins. The only way to get what you want without a JOIN somewhere is query each table and then merge the results in your code.

fuzzy lollipop
yes, this is an idea, but I have more that a 100 queries, so it's not possible to create views for every join I have.I would need some generic translator.I'm thinking at something like how hibernate translate the HQL, but when it does the joins, to change somehow.It's complicated what I need, but I really need it.
CC
JOINS do just what they say, they join the data of two or more tables together, there is no other way around it other than query each table and merge them together into your code, that is a really bad approach. Home grown means just that home grown, hand made code, only from the freshest bits. Get to coding.
fuzzy lollipop
When I sad home made, I meant we bought this, for some advantages that hibernate does not have, and if far more important that the joins.
CC
A: 

Does anybody knows if there is a dialect we can choose for hibernate, for generating the most basic sql possible ? For instance for a Paradox database I think there is no joins, so the sql generated by hibernate will be perfect for me.

CC