HIBERNATE Questions and Answers

Explain the advantages and disadvantages of detached objects

Advantages:
• Detached objects passing can be done across layers upto the presentation layer without using Data Transfer Objects.
• At the time of using long transactions by the user which needs long think-time, it is suggested to split these transactions into some transactions. The detached objects get modified apart from the transaction scope which then can be re-attached to a new transaction.
Disadvantages:
• The usage of detached objects are cumbersome and cryptic. It is suggested not to be cluttered with the session, if possible.
• It is recommended to use DataTransferObjects and DomainObjects that is used to maintain separation between the user interfaces and the Service.