-->
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.  [ 3 posts ] 
Author Message
 Post subject: Informix 9.4, Hibernate 3, Insert Invalid Sql Exception
PostPosted: Tue Jun 07, 2005 3:37 pm 
Newbie

Joined: Wed Mar 16, 2005 8:00 pm
Posts: 3
Location: Boise Id
When I try to insert an object, I get an invalid sql exception.
Hibernate is trying to call last_insert_id(), I haven't been able to find this function in informix.
Thanks in advance.

Pete


Hibernate version:
3.0
Mapping documents:
<hibernate-mapping package="sp.objects" >
<class name="Agency" table="sp_agncy" >
<id name="agencyID" column="agncy_id" type="int">
<generator class="native" />
</id>
<property name="name" type="string" length="512">
<column name="name"/>
</property>
<property name="starsAgencyCode" type="string" length="20">
<column name="stars_cd" />
</property>
<property name="address1" type="string" length="50">
<column name="addr1" />
</property>
<property name="address2" type="string" length="50">
<column name="addr2" />
</property>
<property name="city" type="string" length="50">
<column name="city" />
</property>
<property name="state" type="string" length="2">
<column name="st" />
</property>
<property name="zipCode" type="string" length="10">
<column name="zip" />
</property>
<property name="contactName" type="string" length="50">
<column name="contact_name" />
</property>
<property name="contactEmail" type="string" length="50">
<column name="contact_email" />
</property>
<property name="contactPhone" type="string" length="20">
<column name="contact_phone" />
</property>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
sp.core.ServiceException: sp.core.DAOException: org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: A syntax error has occurred.
at sp.service.spring.AgencyServiceImpl.saveAgency(AgencyServiceImpl.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy2.saveAgency(Unknown Source)
at sp.userinterfaceobjects.agency.AgencyAction.save(AgencyAction.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:430)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at sp.security.SecurityFilter.doFilter(SecurityFilter.java:54)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
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:118)
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:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Name and version of the database you are using:
Informix 9.4
The generated SQL (show_sql=true):
Hibernate: insert into sp_agncy (name, stars_cd, addr1, addr2, city, st, zip, contact_name, contact_email, contact_phone) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: select last_insert_id()


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 3:57 pm 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
Are you sure you're not using the MySQLDialect by mistake?
As far as I can tell, the last_insert_id() function exists only in the MySQLDialect.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 4:11 pm 
Newbie

Joined: Wed Mar 16, 2005 8:00 pm
Posts: 3
Location: Boise Id
Thanks.

That was the key


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