Hi !
I am struglling a while with Hibernate DB schema auto-creation in SAP NetWeaver SE 7.1.
I am managing Hibernate (3.3.2) Entities with help of Stateless EJB.
Everything seems to be ok, until my entities are processed per annotations at system set up time.
I get this Exception allover log files:
-
ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection. Reason: the thread of component "ejbContexts/sap.com/PROJECT/XXX.jar/ManagerBean" in application "sap.com/PROJECT" is currently associated with a restricted resource set and it is not allowed to get connection within it.
-
Related exception :
13503561 [HTTP Worker [3]] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - schema export unsuccessful com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection. Reason: the thread of component "ejbContexts/sap.com/PROJECT/XXX.jar/ManagerBean" in application "sap.com/PROJECT" is currently associated with a restricted resource set and it is not allowed to get connection within it.
at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:59)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:46)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:252)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:353)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
....
-
For schema auto generation I am using <property name="hibernate.hbm2ddl.auto" value="create-drop"/> in persistence.xml
Connection is tried to set up at systems start-up time where no link between DataSource and bean schould be made(in my opinion).
IMPORTANT
When application invokes beans business method, which accesses EntityManager to find Persisted Entities, there is no "restricted resource set" Exceptions anymore - Hibernate simply cannot find related table (it was not auto-generated)
Any ideas, why Hibernate auto-generation could cause such Exception ?
Edited by: Aziris on Jan 17, 2011 7:12 PM