[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: use one connectio nper user - no connection pool

You could consider creating EMF's each with a limited pool (one correction for reading, one for writing) and use a map to get to the EMF when you know what the user is. You have to turn off caching in that case, so changes between EMF are forwarded.

I have a JSE/Swing fat client using EL, but there only one user logs in per running instance of the application, and thus I do not need multiple EMFs. One per application (configured for the one logged in user) suffices.

Tom too




Thomas Haskes wrote:
Hi all,

I really need some help on this Problem. I'm using EL in a JavaSE
Environment and want to have to entitymanagers with different dbuser
connection so that e.g em1 uses "scott" "tiger" and em2 uses "jeff"
"someone" as the database user. I tried to set the user in the
Properties while creating the emf using
Persistence.createEntityManagerFactory("myPu", props)

where the key PersistenceUnitProperties.JDBC_USER and JDBC_PASSWORD are set.

This works fine when the first emf is created but the second emf just
uses the same user as the first. I saw in another post that someone used
not the PersistenceUnitProperties as keys but
"javax.persistence.jdbc.user". I tried that, but this ended up in an
error saying "no suitable driver found".

I tried not to set user password credentials on the emf but on the
entitymanager using the entitymanagerproperties but the the
entitymanager tries to connect to the database using the user "" which I
think is a bug.

What am I missing?

Later,

Tom