aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Is this Dao? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Is this Dao?" Watch "Is this Dao?" New topic
Author

Is this Dao?

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i'm using hibernate and i've the following classes:
domain object:

in order to have persistence code apart, i made:

and finally:

i know i do have to implement proper catching;
now, 2 Qs:
1) is this Dao?
2) is it good to use try catch instead of adding a throws hibernateException?

thanks in advance


java amateur
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
1. It looks like DAO to me.

2. I would wrap a custom exception around the HibernateException. This would further enforce the client/service to code to the interface, thus further hiding the fact that you you are using Hibernate as ORM. So if you change to a different ORM, the client code will not change.

For example:
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
My mistake forgot the last part ...
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i got the idea
thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this Dao?