These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Hiberate - JDBC connectivity problem
PostPosted: Mon Dec 13, 2004 12:01 pm 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
I have a strange problem. I am creating a hibernate session by passing it the JDBC connection (which i get from the connection pool). That means i am not providing the JDBC connection parameters in the hibernate.cfg.xml file

sSessionFactory.openSession(lConn);

where lConn - JDBC pool connection obtained by looking up the datasource in websphere.

Now i am able to perform all operations (insert/update/view) using this connection. But as soon as i try to insert a new value into a NOTE table which has a primary that is generated automatically based on HILO algorithm, it tries to pick up the connection from the config file (hibernate.cfg.xml) and fails to find the connection.

Why does the it search for a default connection. How to get over this problem ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 13, 2004 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well basically you can't use the Hibernate HiLo generator in such an environment, as it needs a new, different connection from the Session. Rewrite your own custom HiLo generator.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 13, 2004 1:30 pm 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
thanks, i am not able to insert the data into the database using the oracle sequence. But now i am facing another problem , my data gets saved alternatively. That is , on 1st click of the save button my data gets inserted. on second click it increments the sequence but i get the error when session.flush is called. On third click again the data gets inserted. This cycle continues. The error i get is as follows

EST] 11dbe111 SystemErr R java.lang.NullPointerException
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement(WSJdbcConnection.java:1719)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1415)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1381)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:109)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:460)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:439)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2335)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.statestr.fxmm.pbg.actions.TestAction.executeAction(TestAction.java:82)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.statestr.fxmm.pbg.common.PBGActionBase.execute(PBGActionBase.java:26)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.statestr.fxmm.pbg.common.navigation.NavigationFilter.doFilter(NavigationFilter.java:70)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.statestr.fxmm.pbg.common.security.SecurityFilter.doFilter(SecurityFilter.java:50)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.statestr.fxmm.pbg.common.profile.ProfileFilter.doFilter(ProfileFilter.java:46)
[12/13/04 12:21:49:235 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:965)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
[12/13/04 12:21:49:250 EST] 11dbe111 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 13, 2004 1:31 pm 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
sorry for the mistake in typing what i meant is i am now able to insert data using oracle sequence instead of using HILO but i am facing the problem stated above...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 13, 2004 1:47 pm 
Newbie

Joined: Thu Nov 11, 2004 3:24 pm
Posts: 17
before printing the stack that i stated earlier it also gives a error saying

net.sf.hibernate.impl.SessionImpl afterTransactionCompletion() was never called


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.