Hi Chris, I was able to reproduce this problem. A SQL trace is showing that OpenJPA is executing the finder against the base table instead of the individual table(s). Please file a JIRA for this bug. I'll get the test code into trunk and then someone (possibly myself) can look into fixing it.
-Jeremy On Mon, May 24, 2010 at 11:55 AM, C N Davies <[email protected]> wrote: > Hi Kevin, > > > > I have L2 disabled as it has been too problematic for me, so it looks like > the issue is in the L1 cache. I don't have a test case I can send out yet > since I'm up at 3am in the morning trying to sort out JPA issues, yet > again. > > > > > Chris > > > > > > From: Kevin Sutter [mailto:[email protected]] > Sent: Tuesday, 25 May 2010 2:23 AM > To: [email protected]; [email protected] > Subject: Re: OpenJPA confusing classes > > > > Hi Chris, > This isn't good if the exact same code was working okay in 1.2.2 and it's > not now. Now that the configuration and usage of the L2 cache is defined > by > the spec, there may be an inconsistency that needs to be resolved. Do you > have the L2 DataCache enabled? It's off by default. > > Or, are you referring to the Persistence Context cache (also known as the > L1 > cache)? > > How much have you been able to debug this problem in order to narrow down > the source? You mention the "cache", but I'm not sure which one you are > referring to. Your scenario looks pretty straight forward. Have you been > able to create a simple testcase to demonstrate the problem? Any > suggestions for resolution? > > Thanks, > Kevin > > On Mon, May 24, 2010 at 10:55 AM, C N Davies <[email protected]> wrote: > > Well that would make sense if I wasn't using table per class. I used this > very same code in 1.2.2 with no issues but 2.0 broke it. > > The DB is not enforcing this contraint, it is OpenJPA or more specifically > the cache > > Chris > > > > -----Original Message----- > From: KARR, DAVID (ATTSI) [mailto:[email protected]] > Sent: Tuesday, 25 May 2010 1:33 AM > To: [email protected]; [email protected] > Subject: RE: OpenJPA confusing classes > > > -----Original Message----- > > From: C N Davies [mailto:[email protected]] > > Sent: Monday, May 24, 2010 8:19 AM > > To: [email protected] > > Subject: OpenJPA confusing classes > > > > Here's a snippet of my ode, > > > > (Department) es.find(Department.class, "N/A"); > > > > (PrintQueue) es.find(PrintQueue.class, "N/A"); > > > > Both Department and PrintQueue entities are based upon the same super > > class > > but I use table per class so they are in separate tables. > > > > As you can see they both have the same key, but if I put the > department > > line > > 1st the find of the print queue will generate a class cast exception > > trying > > to cast a Department to a PrintQueue. If I put the PrintQueue line 1st > > I > > will get a class cast exception trying to cast a PrintQueue to a > > Department. The second find doesn't generate any SQL if I have trace > > logging turned on so it looks to me that it is a cache issue. > > > > I can't see anything like this in the JIRA is it a known bug or not? > > I would assume keys in an inheritance tree have to be unique across the > hierarchy. If not, then there's no way to tell what object it really > refers to. The CCEs are due to the fact that caching in the session > uses the PK as the key (obviously). You already loaded a Department > with that PK, so the reference on the next line is going to load it from > the session, which blows up. > > > >
