[
https://issues.apache.org/jira/browse/OPENJPA-2473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13876513#comment-13876513
]
Rick Curtis commented on OPENJPA-2473:
--------------------------------------
I know there have been numerous bugs uncovered in this area and some of them
have been fixed. As a work around please try to disable the QuerySQLCache.
<property name="openjpa.jdbc.QuerySQLCache" value="false"/>
> Parameters order in prepared statement changes on the second run
> ----------------------------------------------------------------
>
> Key: OPENJPA-2473
> URL: https://issues.apache.org/jira/browse/OPENJPA-2473
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 2.0.0
> Environment: Windows 7 (6.1 7601 SP1), Websphere
> WSJPA-2.0.0-r1118:2068
> openjpa 2.0.0-r422266:935683
> Oracle (ojdbc6)
> Reporter: Eugene Afonin
> Priority: Blocker
>
> Named query:
> @NamedQuery(name = Dcard.FIND_BASE_CARD_BY_DEPOSIT,
> query = "select d, coalesce(d.blockcode, 1) as blkd,
> coalesce(d.endDate, :nulldate) as enddt from Dcard d where "
> + "d.deposit.majorId = :dMajorId and
> d.deposit.minorId = :dMinorId and d.deposit.megaId = :megaId "
> + "and d.holdercode = 0 order by blkd ASC, enddt
> DESC")
> is executed by the following code
> TypedQuery<Object[]> query =
> getEntityManager().createNamedQuery(Dcard.FIND_BASE_CARD_BY_DEPOSIT,
> Object[].class);
> query.setParameter(D_MAJOR_ID, depositKey.getMajorId());
> query.setParameter(D_MINOR_ID, depositKey.getMinorId());
> query.setParameter(MEGA_ID, depositKey.getMegaId());
> query.setParameter("nulldate", new Date(0), TemporalType.DATE);
> List<Object[]> list = query.getResultList();
> Query is excuted as
> prepstmnt 1743939570 SELECT t0.id_major, t0.id_mega, t0.id_minor,
> COALESCE(t0.blockcode,1) AS blkd, COALESCE(t0.enddate,?) AS enddt FROM
> deposit.dcard t0, deposit.deposit t1 WHERE (t1.id_major = ? AND t1.id_minor =
> ? AND t1.id_mega = ? AND t0.holdercode = ?) AND t0.deposit_major =
> t1.id_major AND t0.deposit_minor = t1.id_minor AND t0.id_mega = t1.id_mega
> ORDER BY blkd ASC, enddt DESC [params=(Timestamp) 1970-01-01 03:00:00.0,
> (long) 189018, (long) 222, (int) 38, (long) 0]
> on the first time after server restart.
> Any subsequent run results in:
> prepstmnt 1494440211 SELECT t0.id_major, t0.id_mega, t0.id_minor,
> COALESCE(t0.blockcode,1) AS blkd, COALESCE(t0.enddate,?) AS enddt FROM
> deposit.dcard t0, deposit.deposit t1 WHERE (t1.id_major = ? AND t1.id_minor =
> ? AND t1.id_mega = ? AND t0.holdercode = ?) AND t0.deposit_major =
> t1.id_major AND t0.deposit_minor = t1.id_minor AND t0.id_mega = t1.id_mega
> ORDER BY blkd ASC, enddt DESC [params=(long) 189018, (long) 222, (int) 38,
> (Timestamp) 1970-01-01 03:00:00.0, (long) 0]
> causing oracle error (type mismatch for the first parameter)
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)