You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (Created) (JIRA)" <ji...@apache.org> on 2011/11/22 17:42:40 UTC

[jira] [Created] (OPENJPA-2079) Entity with @Temporal.TIMESTAMP Date field causes INVALID value SQLException on DB2/z when using native name query

Entity with @Temporal.TIMESTAMP Date field causes INVALID value SQLException on DB2/z when using native name query
------------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-2079
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2079
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.1.1, 2.1.2, 2.2.0
            Reporter: Albert Lee


Entity with @Temporal.TIMESTAMP Date field causes INVALID value SQLException on DB2/z when using native name query:

@Entity
@NamedNativeQueries({

	@NamedNativeQuery(
				name="nativeFindTypeTestBeanByucalendar",
				query="SELECT t99.id FROM Entity1 t99 WHERE t99.ucalendar = ?"
	)
})
public class Entity1 implements Serializable {
        ....
	@Temporal(TemporalType.TIMESTAMP)
	public Calendar ucalendar;
	public Calendar getUcalendar() {
		return ucalendar;
	}
}

and

    	Calendar ucalendar =Calendar.getInstance();
        try {
    		Query query2 = em.createNamedQuery("nativeFindTypeTestBeanByucalendar");
    		query2.setParameter(1, ucalendar);
    		List<Integer> lquery2 = query2.getResultList();
        } catch (Throwable tex) {
            ....
        }

Received exception:

<openjpa-2.1.1-SNAPSHOT-r422266:1146888 fatal general error> org.apache.openjpa.persistence.PersistenceException: THE DATE, TIME, OR TIMESTAMP VALUE 1 IS INVALID. SQLCODE=-180, SQLSTATE=22007, DRIVER=3.58.127 {prepstmnt 42267804 SELECT t99.id FROM Entity1 t99 WHERE t99.ucalendar = ? [params=?]} [code=-180, state=22007]SQLCA OUTPUT[Errp=DSNXRIHD, Errd=-155, 0, 0, -1, 0, 0]
THE DATE, TIME, OR TIMESTAMP VALUE 1 IS INVALID. SQLCODE=-180, SQLSTATE=22007, DRIVER=3.58.127
	at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4871)
	at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4831)
	at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:593)
	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:110)
	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:62)
	at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:238)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:315)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331)
	at test.TestTmoSFBean.testMethod(TestTmoSFBean.java:58)
	at test.EJSLocal0SLTestTmoSFBean_6f7a59b8.testMethod(EJSLocal0SLTestTmoSFBean_6f7a59b8.java)
	at test.TestTmoServlet.doPost(TestTmoServlet.java:47)
	at test.TestTmoServlet.doGet(TestTmoServlet.java:37)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1020)
	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703)
	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:953)
	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1655)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1650)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: THE DATE, TIME, OR TIMESTAMP VALUE 1 IS INVALID. SQLCODE=-180, SQLSTATE=22007, DRIVER=3.58.127 {prepstmnt 42267804 SELECT t99.id FROM Entity1 t99 WHERE t99.ucalendar = ? [params=?]} [code=-180, state=22007]
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:281)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:265)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:72)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1183)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:284)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1783)
	at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:274)
	at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:318)
	at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:221)


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira