posted 14 years ago
Hi Everyone..
I have a situation where i have to create a dynamic query based on a custom criteria that will be passed to me.
So, i plan to generate an HQL query from the dynamic criteria and execute the HQL.
but there will be certain validations that i will need to take care of(like the two entities that are passed in the custom criteria are indeed entities and validating the column names and getting their types...)..
I was thinking i could load the class metadata and use it for all my requirements...
Another option is storing all these attributes of the tables, their columns and their attributes in another table and querying that table to get the required info.
Which of these two is a better option.
How expensive is getting the metadata of a particular entity....
I think since hibernate already loads the metadata when it starts up, getting it should be pretty inexpensive...
What are your thoughts on this?
Thank you,
Rahul