Вопрос

I'm implementing data access logic in a Java application using Hibernate and I'm a little confused about this issue. AFAIK one of the main advantages to use ORM systems is to work with attached object, but using DAO approach leads to have (in many application contexts) detached entities.

I read several posts about this issue (this for example), but I can't understand if there is a correct apporach to follow, or if the choice is left to developer. Can you help me?

Это было полезно?

Решение

Why do you think that not using DAOs is going to alleviate your detached objects scenarios? I don't think it will. If you want to use ORM, you simply need to re-attach objects sometimes.

In the answer to a related question, I argue that you really should use DAOs.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top