Larry Meadors a écrit :
I think I would still like to have the freedom of writing normal SQL queries while having the flexibility of using a mapping tool. I guess Hibernate does
provide that kind of flexibility.



Wo, you did a great job of describing iBATIS for not ever using it: It uses normal SQL queries, and maps them to POJOs or normal java Collections.

Not quite the same really, if I understand well what you're saying. In Hibernate, although you can still use real SQL queries, most of the time you don't. You rather use HQL (Hibernate Query Language) to get your queries done. Suppose you have three tables :

customer(custId,name) * <- buys -> * good(goodId, label)* <- sold by -> * shop(shopId,name)

this leads to this data logic model :

customer --- customer_good --- good_shop --- shop

Getting a particular shop from customer_goods means doing something like

Query q = hibernateSession.createQuery("select cg.goodshop.shop from CustomerGood as cg where cg.goodshop.shop.name = :shopname");
q.setString("shopname","Wall Mart");
List shops = q.list();

With this query language, you can get "through" tables quite easily.

However, I agree with previous comments saying that Hibernate is useful if your project is quite large. Otherwise, the time taken to set it up would be better used to do something else. It does add some complexity when thinking through a new project, and in case of an existing one, there are too many changes that would need to be done to it to be really interesting in my opinion (or else, said project wasn't really big anyway).
--
Stéphane Zuckerman

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to