Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Loading the metadata of the table

 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any comments please...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic