Thread:
 This pattern can be used instead of the DAO patter... 
 jweiskotten   14 Jul 2005, 00:50 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: jweiskotten (14 Jul 2005, 00:50) Replies: 0, Views: 36002
Subject: This pattern can be used instead of the DAO pattern
The "Root Persistent Class" pattern is a nice alternative to the DAO
pattern. It can be extended by other abstract classes that add more
layers of behavior (such as one that has name and description for config
objects).

You are making the persistence transparent by putting the
Hibernate-specific code in the base class, and you don't have to write
an extra DAO for each persistent object.

Additional transparency could be achieved by delegating all calls to
Hibernate to another class. This way you would only need to change the
delegate if you want to use a different persistence layer that has
similar semantics (like EJB3). Your base class could probably stay the same.

The downside is that your objects need to extend from a base class, and
given Java's single-inheritance "limitation", you lose some flexibility
in architecture. You can always delegate or forward to another object if
you need to, though.
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]