Hi!
I am member of the team that develops JPA in SAP's Netweaver Server.
Recently we had an issue with Hibernate as a persistence provider for
JPA.
During injection of EM/EMF into stateless session bean, our
ORPersistenceObjectFactory creates a new instance of Hibernate
EntityManagerFactory. During initialization HibernateEMF tries to get a
DB connection but at this point of time this is forbidden and an
exception is thrown. This exception is ignored from Hibernate :
try {
Connection conn =
connections.getConnection();
try {
.......................
}
finally {
connections.closeConnection(conn);
}
}
catch (SQLException sqle) {
log.warn("Could not obtain connection
metadata", sqle);
}
catch (UnsupportedOperationException uoe) {
// user supplied JDBC connections
}
After that EMF is normally created and returned to session EJB. After
that when EM is used it check's if connection was already created and if
not creates a new one "
public Connection getConnection() throws HibernateException {
if ( isClosed ) {
throw new HibernateException( "connection
manager has been closed" );
}
if ( connection == null ) {
openConnection();
}
return connection;
}
Hibernate and the our JPA container implementation is also correct. The
only one problem is that this exception is logged during the first
request to the related application. My question to you as the
development team of Hibernate is whether you are aware of this
situation. It would be nice to have Hibernate running on our engine more
smoothly.
Best Regards,
Robin