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