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

Hi Tim,

thank you for your reply.
I also implement DAO using generics. I have a BaseDAO <T> and many DAO that extend teh BaseDAO defining the Entity class they work on.
My question is related to more on performance and/or control (synchronization), when JPA is used also on my "public" pages (I mean to serve http client request). Can be a static or singleton DAO a bottleneck for many request?Is it better to create a new DAO instance to serve any request?


BR,
Enrico

Tim Hollosy ha scritto:
I use a single DAO for all my CRUD, then I don't have to implement the DAO each time.

It has methods that are templated like this:


public <T extends AbstractEntity> List<T> selectAll(Class<T> clazz) {
return (List<T>) JpaHelper.getEntityManager(entityManager).createQuery(null,clazz).getResultList()


}