[hibernate-dev] Hibernate as JPA persistence-provider in SAP Netweaver

Steve Ebersole steve at hibernate.org
Wed Aug 29 10:44:18 EDT 2007


We are aware that the Hibernate SessionFactory attempts to obtain a Connection 
during its construction in order to query the JDBC metadata, yes.

I think you may be slightly confused (it seems that way to me anyway).  The 
connection obtained during construction of a SessionFactory has absolutely 
nothing to do with the connections used by sessions.

On Wednesday 29 August 2007 08:29:58 am De Silva Jayasinghe, Robin wrote:
> 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
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list