openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Lee (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-421) OpenJPA generates bad SQL before configuration fully populated
Date Mon, 29 Oct 2007 16:54:50 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538541
] 

Daniel Lee commented on OPENJPA-421:
------------------------------------

notepad reads it okay but not emacs.  emacs will be used in addition to verify the patch in
the future.

> OpenJPA generates bad SQL before configuration fully populated
> --------------------------------------------------------------
>
>                 Key: OPENJPA-421
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-421
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.0, 1.0.1, 1.1.0
>            Reporter: Daniel Lee
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-421.patch, OPENJPA-421.patch
>
>
> When openjpa.jdbc.DBDictionary is set in persistence.xml file, OpenJPA creates a new
DBDictionary instance by loading the class specified in the properties without trying to connect
to database.   It leaves version related configuration unset until the first connection to
the database and creates the window of referencing partial properties in the DBDictionary.
 The problem happens when the first sql statement gets constructed within this window with
lack of the knowledge of the version of the database.
> For example, with the setting that described below, BIGINT was generated in the
> SQL statement to be run on DB2 z/OS V8 and failed to execute because BIGINT was not supported
on that version of z/OS DB2.
> 1. commenting out the setting of "openjpa.jdbc.SynchronizeMappings".
> 2. configure the connection properties to a z/OS database
> 3. issuing a statement similar to the following to generate SQL statement with
>    "CAST(? AS BIGINT)".
> Here is the testcase that I use to create the problem:
> {
>     EntityManagerFactory emf1 = 
>         Persistence.createEntityManagerFactory("demo");
>     EntityManager em1 = emf1.createEntityManager();
>     em1.getTransaction().begin();
>     Order o3 = (Order) em1.createQuery(
>         "select o from Order o where o.oid = 68").getSingleResult();
>     ...
> }
> ==>
>   SELECT t0.oid, t0.version, t0.amount, t0.delivered FROM Order t0
>     WHERE (t0.oid = CAST(? AS BIGINT)) optimize for 1 row [params=(long) 68]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message