Hi!
I have very simple question which demands very long answer:) I'm using EntityManagerFactory and EntityManager. Configuration is done in runtime with this method:
Code:
public static void init(LoginInfo info, String PU)
{
props.put("hibernate.connection.url", "jdbc:oracle:thin:@" + info.getDbLoginInfo().getConnString());
LOG.debug(props);
props.put("hibernate.connection.username", info.getDbLoginInfo().getUsername());
props.put("hibernate.connection.password", info.getDbLoginInfo().getPassword());
configuration.configure(PU, props);
try
{
emf = configuration.buildEntityManagerFactory();
LOG.debug("EntityManagerFactory opened.");
}
catch (RuntimeException e)
{
LOG.error("EntityManagerFactory not opened. " + e.getMessage());
}
if (Conf.SSO_TEST_MODE)
System.out.println(props);
}
Under certain condition this init method is not good. I got underlying jdbc connection and I must use it. How can I inject that connection to EntityManagerFactory.
I must also do some alter_session statements and those are done through jdbc connection, so this is another reason for that kind of approach.
Any ideas?
Thank you all very much for help.