[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] DAO implementation: static?singleton?or instances?

Dear all,

I have written my Entity class and my DAO class (a DAO for each entity) that implements CRUD operation.
My sopurce code architecture has:
- A base DAO implementation (that implement an interface) with CRUD operation.
- I use generics in order to have all DAO class that simple extend the basic DAO, declaring the class Entity they work on


I would like to know what is the better solution between the following cases:
- 1. implement singleton DAOs
- 2. implment static method for DAOs
- 3. implement instances DAO (instance a new DAO ojbect every time i need to to do CRUD operation on that table/relationhip.


Currently i have implemented case 3. I think it is good but i don't like to have a new instance of DAO every time I need to access a table.So, I am thinking if possible to use case 1 or 2, but I would like to know what are the advantage/disadvanges of those solution in comparison to the current implementation.
Can anyone give me some suggestion, please?



BR, Enrico