hi there!
I've been searching for ways to optmize my HQL queries. I was able to reduce the number of selects with the "left join fetch", but not like in the examples I found. They [the examples] shows the query in the form "select <columns> from <table> where <condition> left join fetch <relation>", but always I did like this I got the syntax error , now my queries are like "from <table> left join fetch <relation> where condition>" - I wander if the two forms are equivalent.
tutorial site:
http://www.javalobby.org/articles/hiber ... e=archives
Now I want to reduce the number of columns retrivied with the "select new" type of query. But I've some doubts I haven't been able to elucidate.
1) The queries are based on DAO's classes - what I would like to do is instantiate the constructors on the concrete classes - the POJO's - of course, remebering of the empty constructor Hibernate needs to creat the objects, - there is a way to do this or I need to create new (simple - just the fields that representing the columns I need) POJO's and new DAO's classes? or just the creation of a POJO is enough?
2)How a reference the class in the constructor on the HQL string query? I use the getClassName followed by an alias to reference the class in my string queries - so it would by like "select <alias>(<alias>.field1,...,<alias>.fieldn) from getClassName() <alias>"?
3) Can I create as many constructor as I need in the same class to use in the HQL query? Or do I really need to create a class for each constructor used in the query? This sucks, besides, i will loose on efficiency - There are any paper comparing the efficiency of the various form of querying?
Thanks for all.