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 05:42 Go to next message
Ali Afroozeh is currently offline Ali Afroozeh
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 09:48 Go to previous message
James Sutherland is currently offline James Sutherland
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: Wed Aug 20 16:32:17 EDT 2014

Powered by FUDForum. Page generated in 0.07142 seconds