-->
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.  [ 2 posts ] 
Author Message
 Post subject: save failure for DB2 and tomcat
PostPosted: Wed Aug 18, 2004 6:10 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
Hibernate version:
Hibernate2.1

Mapping documents:
<class
name="com.merchantspace.commons.datatransfer.AttributeGroupDTO"
table="TATTRIBUTEGROUP"
>
<id
name="uidPk"
type="int"
column="UID_PK"
>
<generator class="sequence">
<param name="sequence">SATTRIBUTEGROUP</param>
</generator>
</id>
<property
name="name"
type="java.lang.String"
column="NAME"
not-null="true"
length="200"
/>
<property
name="deleted"
type="boolean"
column="DELETED"
not-null="true"
length="1"
/>
<property
name="type"
type="java.lang.String"
column="TYPE"
length="255"
/>


Code between sessionFactory.openSession() and session.close():
AttributeGroupDTO dto = new AttributeGroupDTO();
dto.setName("test AG");
s.save(dto);
tx.commit();

Full stack trace of any exception that occurs:
net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at com.merchantspace.dataaccess.hibernate.AttributeGroupDAO.add(AttributeGroupDAO.java:39) at com.merchantspace.business.domain.AttributeGroupBO.add(AttributeGroupBO.java:43) at org.apache.jsp.manager.attributeGroupAdd_jsp._jspService(attributeGroupAdd_jsp.java:203) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644) at java.lang.Thread.run(Thread.java:534) Caused by: com.ibm.db2.jcc.b.SQLException: "DB2ADMIN.DUAL" is an undefined name. at com.ibm.db2.jcc.b.ce.e(ce.java:1093) at com.ibm.db2.jcc.b.ce.a(ce.java:869) at com.ibm.db2.jcc.a.bd.g(bd.java:125) at com.ibm.db2.jcc.a.bd.a(bd.java:40) at com.ibm.db2.jcc.a.r.a(r.java:31) at com.ibm.db2.jcc.a.bp.g(bp.java:141) at com.ibm.db2.jcc.b.ce.h(ce.java:853) at com.ibm.db2.jcc.b.cf.G(cf.java:1185) at com.ibm.db2.jcc.b.cf.a(cf.java:1497) at com.ibm.db2.jcc.b.cf.executeQuery(cf.java:303) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 34 more


Name and version of the database you are using:
DB2, db2jcc.jar for jdbc driver


It works fine without tomcat.

However, the save can't be done when using tomcat. It can retrieve info from database, but can't save.

Please help me.

Ping


Top
 Profile  
 
 Post subject: The Solution!
PostPosted: Fri Oct 15, 2004 5:29 am 
Newbie

Joined: Mon Oct 11, 2004 8:13 am
Posts: 3
Location: germany
Hello,

this may be the solution, if you are using a schema for your tables:

http://forum.hibernate.org/viewtopic.php?t=930484&highlight=schema+generator
Topic: generator doesen't respect schema of table

had the same problem myself...
this bug seems to be known, but they won't fix 'em. too bad!

the generator doesn't respect the schema of your table and this way the userid is used as schema name instead.

this way it works:
Code:
<generator class="increment">
   <param name="schema">XXX</param>
</generator>


greetings
bastian


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.