on 11-11-2006 9:41 PM
hi all,
<b>i am using SAP Netweaver Developer studio. have problem using hibernate in a EJB Modul Project. i have create a stateless session bean to writie the bussiness logic using my hibernate mapping classes, but somehow i get the error:</b>
Details: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method createPerson.
at src.ejb.HibernateLocalLocalObjectImpl0.createPerson(HibernateLocalLocalObjectImpl0.java:407)
at com.servlet.TestServlet.doPost(TestServlet.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
Caused by: java.lang.ExceptionInInitializerError
at src.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:29)
at src.ejb.HibernateBean.createPerson(HibernateBean.java:158)
at src.ejb.HibernateLocalLocalObjectImpl0.createPerson(HibernateLocalLocalObjectImpl0.java:391)
... 17 more
Caused by: org.hibernate.HibernateException: Could not instantiate TransactionManagerLookup
at org.hibernate.transaction.TransactionManagerLookupFactory.getTransactionManagerLookup(TransactionManagerLookupFactory.java:47)
at org.hibernate.transaction.JTATransactionFactory.configure(JTATransactionFactory.java:48)
at org.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:51)
at org.hibernate.cfg.SettingsFactory.createTransactionFactory(SettingsFactory.java:401)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:129)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
at src.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:24)
... 19 more
<b>is there anybody can tell me why i am getting this error? i was sitting in front of the computer for days now, but could find out where i am doing wrong.
i have tested my hibernate classes without session beans(in a normal java Project, every thing works fine. and i tried to do exactly what they have done in the HibernateExampleEHCache examples, to combine my hibernate with session beans together, but couldn't get the programm running. </b>
<b>now i have delete this part from my hibernate,cfg,xml</b>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.SAPWebASTransactionManagerLookup
</property>
<property name="hibernate.session_factory_name">
hibernate/SessionFactory
</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<!<property name="hibernate.cache.use_query_cache">true</property>>
<b>the error changed to:</b>
org.hibernate.HibernateException: org.hibernate.exception.GenericJDBCException: could not get next sequence value
Caused by: com.sap.sql.log.OpenSQLException: The SQL statement "SELECT "HIBERNATE_SEQUENCE"."NEXTVAL" FROM "DUAL"" contains the semantics error[s]: table "DUAL" unknown
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you sure this is the right value for the class name?
org.hibernate.transaction.SAPWebASTransactionManagerLookup
Is it on the classpath?
Message was edited by:
F.J. Brandelik
Looks as well like you have implemented a primary index scheme (next value) that is not supported by your DB ?
See error on DUAL
Are you sure this is the right value for the class name?
org.hibernate.transaction.SAPWebASTransactionManagerLookup
<b>No, i am not sure. i just copied it from a example. but i think i will not need it. so i have deleted them now.</b>
Looks as well like you have implemented a primary index scheme (next value) that is not supported by your DB ?
See error on DUAL
<b>I just used sequence for the primary key in my Person.hbm.xml. even i change it to native, it comes back with the same error too.</b>
<b>Person.hbm.xml:</b>
<class name="src.hibernate.Person" table="TMP_PERSON">
<id name="id" column="PERSONID">
<generator class="native"/>
<b>java class:</b>
public class Person {
private Long id;
getter and setter
...}
<b>my method in a stateless session bean:</b>
public Long createPerson(
String surname,
String firstname,
String tel,
String email) {
Session session = null;
Transaction tx = null;
try {
session = HibernateSessionFactory.openSession();
tx = session.beginTransaction();
Person aPerson = new Person();
aPerson.setSurname(surname);
aPerson.setFirstname(firstname);
aPerson.setTelNr(tel);
aPerson.setEmail(email);
Long personId = (Long)session.save(aPerson);
tx.commit();
return personId;
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
throw new HibernateException(e);
} finally {
HibernateSessionFactory.closeSession(session);
}
}
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.