We're using Hibernate in our project, but we eventually found out that some kinds of queries were too complicated for it.
So, after studing a bit the Hibernate in Action book and the documentation chapter about SQL, I tried to use SQL queries in our project.
Anyway, Direct SQL queries work ok, but I'm having problems with the placeholders scheme.
Actually, our normal queries are built in a XML format and later transformed into HQL by some of our classes. This XML contain the classes and columns written in a especific format that's not useful to Hibernate. We pick them up, and adapt them to the HQL proper format.
The idea with the SQL is to use this specific format names inside the placeholder "{}" and modify and replace them on the fly.
Anyway, what I really need to know. is: Do I need to use the .addEntity() method together with the placeholders or not? Because as I have a variable amount of classes involved in the different classes, adding entities on the run would be very hard. I don't want to build the whole Hibernate query method for each of the queries (right now we just call the proper method and pass the query String to it).
We are working with the ResultSet full of scalars, not the especific entities.
P.s.: If I'm not being very clear about my problem, please tell me and I'll try to explain it better.
_________________ Falci - Heavy Worker!
|