Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA build entity manager with a specific JDBC connection instance
JPA build entity manager with a specific JDBC connection instance [message #532807] Tue, 11 May 2010 09:42 Go to next message
Ali Afroozeh is currently offline Ali AfroozehFriend
Messages: 2
Registered: May 2010
Junior Member
I want to manage the database connection outside entity manager context so that I can use it for different entity managers. The question is how can I build the entity manager factory or entity manager with my own connection instead of providing it with properties in persistence.xml?
Re: JPA build entity manager with a specific JDBC connection instance [message #533353 is a reply to message #532807] Thu, 13 May 2010 13:48 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Using the same JDBC connection for multiple EntityManager does not sound like a good idea. What are you trying to accomplish?

If you use JTA, then all JDBC access in the same JTA transaction will use the same JDBC connection.

You can set the connection in an EntityManager but accessing its ClientSession and setting the writeConnection's connection.

You could also try customizing your own ConnectionPool in your ServerSession.




James : Wiki : Book : Blog : Twitter
Previous Topic:Is it possible to run a @TableGenerator in a separate transaction?
Next Topic:MappedSuperclass doesn't work with dynamic weaving
Goto Forum:
  


Current Time: Thu Apr 25 17:58:11 GMT 2024

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

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

Back to the top