Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA DAO in Desktop Application
JPA DAO in Desktop Application [message #480317] Fri, 14 August 2009 21:59 Go to previous message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 92
Registered: July 2009
Member
Hello Everyone

I've got one more question and hopefully someone can help me out here, since all
tutorials and pages I've found for JPA dont cover the DAO usage. At least not
for J2SE environments. In a Container I can just put a @EntityManager annotation
on my DAO and everything is fine but I have no clue how I should do this for my RCP.

But maybe I should start by what I already have. EclipseLink is started as
rcp-bundle and I can obtain the EntityManagerFactory for my persistence.xml. I
am also able to create EntityManger but I dont know what is the right/efficient
way for my DAOs.

Do I have to create a EntityManager for each DAO, and does it always has to be a
newly created one? Or can I reuse EntityManager-Instances (Singleton anybody ;) ).

Currently I have a Singleton-Class called JpaManager which creates the
EntityManagerFactory and this one also creates the DAOs and passes a
EntityManager Instance (which is reused). When I run my test I get an exception
regarding multiple entities in one session. I found something about a
SessionBroker but I am cufused if my approach might be totaly wrong at all (so a
SessionBroker will not help me in the end).

Could somebody clarify this a bit for me, and maybe give a best-practise tip?

Thanks in advance
-- Marc
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:MergeChangeSetCommand NullPointerException" in remote EclipseLink Session
Next Topic:Eclipselink queries on DB2
Goto Forum:
  


Current Time: Sun Jul 07 22:28:44 GMT 2024

Powered by FUDForum. Page generated in 0.02429 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top