[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2043?page=c...
]
Zahid Shaikh commented on HHH-2043:
-----------------------------------
I have the same issue.. I am using informix 10.. As far as I know 3.0.JC3 is the latest.
If I use "old driver" then i am sure that it will fire "extra" query
from "systab" table to get the PK.(ie not optimized)
There is an bug in InformixDialect preventing generator-class=native
to work.
-----------------------------------------------------------------------------
Key: HHH-2043
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2043
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4
Environment: hibernate version 3.1.3, IBM Informix Dynamic Server Version 10.00.FC3R1,
JDBC IBM Informix driver ver 3.0.JC3 (ifxjdbc-3.0-jc3.jar)
Reporter: Andrew from Poland
Priority: Minor
Original Estimate: 2 hours
Remaining: 2 hours
When there is an column of SERIAL or SERIAL8 type (identity types in Informix) database
expect this column to appear in INSERT clause with value equal 0, for example:
INSERT into my_table (my_serial_column, other_column) values (0, "some value");
- in this example my_serial_column is an identity column.
Using current InformixDialect this insert looks like this:
INSERT into my_table (other_column) values ( "some value");
which causes an exception:
java.sql.SQLException: Error In Specifying Automatically (Server) Generated Keys.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3208)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1153)
at com.informix.jdbc.IfxPreparedStatement.e(IfxPreparedStatement.java:318)
at com.informix.jdbc.IfxPreparedStatement.a(IfxPreparedStatement.java:298)
at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:275)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:2077)
at
org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:418)
at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:385)
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:585)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:40)
at $Proxy10.prepareStatement(Unknown Source)
...
I've tested a solution - dialect must redefine getIdentityInsertString method like
this:
public String getIdentityInsertString() {
return "0";
}
After that identity column appear in INSERT clause with value set to 0.
I'am using hibernate version 3.1.3, but in the latest build 3.2.0.cr4 problem still
exist (i've downloaded it and checked InformixDialect.java file).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira