hi,
we have a dilema :
one option is to use Views in the DataBase in this case, and create entities with hibernate reverse engineering , for each view .
we have about 40-50 joins in our application in this stage.
the other option ,as i saw, is to do this join in HQL , such as this example :
List cats = session.createCriteria(Cat.class)
.createCriteria("kittens")
.add( Restrictions.like("name", "Iz%") )
.list();
the problem is that i read that there are problems with this solution:
1. retrieving too much rows (distinct issue)
2. the Criteria layer is hidden in our App , we use :
dao.addCriterion(dao.createCriterion(a,b))
so it will change our conception.
there is other opinion to use a "free" Sql and deliver it to the hibernate.
what is more easy , right , performance wise better , and will "cost" less to change in case of a change in the view .
please advise ,
thanks,
Yair
|