Hello!
i'm trying to make a bulk update:
String hqlUpdate = "update GroupMobilePhoneAddressesElement "
+" set groupCount = :newGroupCount "
+" where mobilePhoneAddress.id = :theMpaId";
session.createQuery( hqlUpdate )
.setString( "newGroupCount", ""+newGroupCount )
.setString( "theMpaId", ""+theMpaId)
.executeUpdate();
the erroneous sql generated is:
Hibernate: update rel_group_mobile_phone_address set GROUP_COUNT=? where groupmobil0_.ID=?
and the oracle error is java.sql.SQLException: ORA-00904: not valid column name
how I can address the id of mobilePhoneAddress correctly? It doesn't require a join because the mobilePhoneAddress.id is stored in the table rel_group_mobile_phone_address (look down the mapping...)
thank you for help
Hibernate version:3.0.5
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="it.mobis.sms.GroupMobilePhoneAddressesElement" table="rel_group_mobile_phone_address">
<cache usage="read-write"/>
<id name="id" type="long" unsaved-value="0" >
<column name="ID" sql-type="number(10,0)" not-null="true"/>
<generator class="sequence">
<param name="sequence">GROUP_MOBILE_PHONE_ADDR_SEQ</param>
</generator>
</id>
<!--<timestamp column="TIMESTAMP" name="timestamp" />-->
<property name="insertDate">
<column name="INSERT_DATE" not-null="true"/>
</property>
<property name="removeDate">
<column name="REMOVE_DATE"/>
</property>
<property name="groupCount">
<column name="GROUP_COUNT" sql-type="number(7,0)" not-null="true"/>
</property>
<!--
<property name="pos">
<column name="POS" sql-type="number(10,0)" not-null="true"/>
</property>
-->
<many-to-one name="mobilePhoneAddress" class="it.mobis.sms.MobilePhoneAddress">
<column name="MOBILE_PHONE_ADDRESS_ID" sql-type="number(10,0)" not-null="true"/>
</many-to-one>
<many-to-one name="group" class="it.mobis.sms.Group">
<column name="GROUP_ID" sql-type="number(7,0)" not-null="true"/>
</many-to-one>
</class>
</hibernate-mapping>
stack trace of exception :
org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:99)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:871)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at it.mobis.sms.service.GroupServiceBean.updateAllGroupMpa_GroupCount(GroupServiceBean.java:185)
at it.mobis.sms.service.GroupServiceBean.removeMpaImpl(GroupServiceBean.java:237)
at it.mobis.sms.service.AbstractGroupServiceBean.removeMpa(AbstractGroupServiceBean.java:147)
at it.mobis.sms.service.JOnASGroupServiceEJBRemote.removeMpa(JOnASGroupServiceEJBRemote.java:177)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.runDispatch(JUnicastServerRef.java:165)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:149)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: ORA-00904: nome di colonna non valido
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1602)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1527)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2045)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:395)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)
... 20 more
)
at it.mobis.sms.service.GroupServiceBean.removeMpaImpl(GroupServiceBean.java:244)
at it.mobis.sms.service.AbstractGroupServiceBean.removeMpa(AbstractGroupServiceBean.java:147)
at it.mobis.sms.service.JOnASGroupServiceEJBRemote.removeMpa(JOnASGroupServiceEJBRemote.java:177)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.runDispatch(JUnicastServerRef.java:165)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:149)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at org.objectweb.carol.rmi.jrmp.server.JRemoteCall.executeCall(JRemoteCall.java:91)
at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.invoke(JUnicastRef.java:165)
at it.mobis.sms.service.JOnASGroupServiceEJBRemote_Stub.removeMpa(Unknown Source)
at it.mobis.sms.proxy.AbstractGroupProxy.removeMpa(AbstractGroupProxy.java:237)
at it.mobis.sms.smslucca.servlets.ModifyDataServlet.doGetImpl(ModifyDataServlet.java:75)
at it.mobis.util.web.ServletBase.doGet(ServletBase.java:66)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
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:
oracle 8.1.7
|