Setting "openjpa.jdbc.QuerySQLCache = false" also solved a strange SQL
ordering problem while deleting entities on our project (Cannot delete or
update a parent row: a foreign key constraint fails).
ekin.
On Tue, Sep 23, 2008 at 10:56 AM, Ekin Sökmen <[EMAIL PROTECTED]> wrote:
> I have the same issue. I traced the sql logs and saw that cascaded select
> queries (eager fetching) are executed using wrong IDs.
>
> DataCache and QueryCache were already disabled. But setting
> "openjpa.jdbc.QuerySQLCache = false" solved the issue (as a temp
> workaround).
>
> I'm short in time but I will try to create a test case.
>
> ekin
>
>
> On Fri, Sep 19, 2008 at 3:29 PM, Kevin Sutter <[EMAIL PROTECTED]> wrote:
>
>> Egoosen2,
>> One new feature that went into 1.2.0 was the ability to cache some of the
>> generated sql on common queries. Previous to this change, every query or
>> findBy operation required the same sql to be generated over and over
>> again.
>> It may be possible that the caching is picking up the wrong sql for the
>> scenario that you describing. As a quick test, could you try running with
>> this sql query cache turned off? The property follows:
>>
>> openjpa.jdbc.QuerySQLCache = false
>>
>> If you could try this and let us know the results, it will help with
>> narrowing down the scope of the problem.
>>
>> Thanks!
>> Kevin
>>
>> On Fri, Sep 19, 2008 at 2:49 AM, egoosen <[EMAIL PROTECTED]
>> >wrote:
>>
>> >
>> > I'm experiencing a strange bug in 1.2.0, on an eager loaded one to many
>> > relationship.
>> > The first time I run the code, openJPA retrieves the parent entity and
>> > eager
>> > fetches the CORRECT child entities.
>> > The second time around, it fetches the parent entity and fetches the
>> > INCORRECT child entities (specifically, it fetches the child entities of
>> > the
>> > parent entity in the previous query).
>> >
>> > Here's the SQL to illustrate:
>> > First run:
>> > SELECT t0.AMDCTL_ID, t0.VRS_NBR, t0.AMDSEQ_CDE, t0.DPLORD_NBR,
>> t0.FND_CDE,
>> > t0.RSL_DTE FROM EBSTATUS.TBL_AMDCTL t0 WHERE t0.FND_CDE = ?
>> > [params=(String) 0000001]
>> > SELECT t0.AMDCTL_ID, t1.AMDDES_ID, t1.VRS_NBR, t1.AMD_DES, t1.AMDCTL_ID,
>> > t1.EFC_DTE FROM EBSTATUS.TBL_AMDCTL t0 INNER JOIN EBSTATUS.TBL_AMDDES t1
>> ON
>> > t0.AMDCTL_ID = t1.AMDCTL_ID WHERE t0.FND_CDE = ? ORDER BY t0.AMDCTL_ID
>> ASC
>> > [params=(String) 0000001]
>> >
>> > Second run:
>> > SELECT t0.AMDCTL_ID, t0.VRS_NBR, t0.AMDSEQ_CDE, t0.DPLORD_NBR,
>> t0.FND_CDE,
>> > t0.RSL_DTE FROM EBSTATUS.TBL_AMDCTL t0 WHERE t0.FND_CDE = ?
>> > [params=(String) 0001001]
>> > SELECT t0.AMDCTL_ID, t1.AMDDES_ID, t1.VRS_NBR, t1.AMD_DES, t1.AMDCTL_ID,
>> > t1.EFC_DTE FROM EBSTATUS.TBL_AMDCTL t0 INNER JOIN EBSTATUS.TBL_AMDDES t1
>> ON
>> > t0.AMDCTL_ID = t1.AMDCTL_ID WHERE t0.FND_CDE = ? ORDER BY t0.AMDCTL_ID
>> ASC
>> > [params=(String) 0000001]
>> >
>> > Somehow its caching the second query, even though I've turned off the
>> > DataCache and QueryCache.
>> >
>> > I've had to revert back to OpenJPA 1.1.0.
>> >
>> > Here's my mappings:
>> > TblAmdctl.java
>> > @OneToMany(mappedBy="tblAmdctl",fetch = FetchType.EAGER,cascade = {
>> > CascadeType.PERSIST,CascadeType.MERGE})
>> > private Collection<TblAmddes> tblAmddess = new ArrayList<TblAmddes>();
>> >
>> > TblAmddes.java
>> > @ManyToOne(fetch = FetchType.LAZY,cascade = {
>> > CascadeType.PERSIST,CascadeType.MERGE })
>> > @JoinColumns([EMAIL PROTECTED](name =
>> > "AMDCTL_ID",referencedColumnName="AMDCTL_ID")})
>> > @ForeignKey
>> > private TblAmdctl tblAmdctl;
>> >
>> > --
>> > View this message in context:
>> >
>> http://n2.nabble.com/OpenJPA-1.2.0-Bug-on-FetchType.EAGER-tp1100274p1100274.html
>> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> >
>> >
>>
>
>