-->
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.  [ 1 post ] 
Author Message
 Post subject: Using Hibernate with SJSAS 9.0 PE
PostPosted: Wed Sep 20, 2006 3:20 am 
Newbie

Joined: Thu Sep 07, 2006 9:33 pm
Posts: 4
Im trying to update two MySQL databases (MySQL version 5.0.20) inside a single UserTransaction in Hibernate.

My Java Code:
Code:
tx.begin();         
sf.getCurrentSession().save(ctmr);         
sf2.getCurrentSession().save(fts);                  
tx.commit();


I have two separate hibernate configuration files for each session factory (sf and sf2). I created a JDBC resource and JDBC Connection Pool for each database in Sun Java System Application Server Admin Console (both of these ping successfully). I connect to these using the following code in my configuration files:

hibernate1.cfg.xml:
Code:
<property name="connection.datasource">jdbc/__MySQLPool</property>


hibernate2.cfg.xml:
Code:
<property name="connection.datasource">jdbc/__MySQLPool2</property>>


However when I run my java code I get the following exception:
Code:
Cannot open connection org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:363)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:122)
org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:93)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1948)
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:559)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:543)
springapp2.controllers.OutputController.handleRequest(OutputController.java:106)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:717)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:658)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:
javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:
-------------------------------------------
-

I cant seem to find the problem because if I only update one database in my UserTransaction then the code works perfectly. Its only when I try updating two different databases inside the one UserTransaction that I get this problem.

I have to update both the databases in the one transaction - using two separate transactions is not an option.

If anyone can provide help on the matter that would be much appreciated.

Outlaw.


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

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.