This is good information. I am good with ignoring it too as long as it does not
effect OpenJPA or any other functionality 

Phill

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jacek Laskowski
Sent: April 17, 2007 6:16 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Duplicate query

On 4/17/07, Hans J. Prueller <[EMAIL PROTECTED]> wrote:

>  it took some time but finally I can send to the TRACE. As it is 
> rather long I'll paste it below. Additional information:

Thanks for the information. It's helped me a lot to narrow down the issue. I
think it's misconfiguration that causes it and I don't think that we could call
it a bug, but some improvements in OpenJPA configuration of PUs would be
welcome.

I think that the first query parsing occurs because in Java EE environments a
jpa container is supposed to find all managed persistence classes (see Chapter 6
Entity Packaging of the JPA spec).
So, OpenJPA searches all the roots of persistence units and collect information
on them. That's why you see the first message about the query.

1679  lbsims  TRACE  [RMI TCP Connection(7)-127.0.1.1] openjpa.MetaData -
parsePersistentTypeNames() found [com.lbslogics.ims.model.PositionLog].
...
2203  lbsims  TRACE  [RMI TCP Connection(7)-127.0.1.1] openjpa.MetaData -
Parsing class "com.lbslogics.ims.model.PositionLog".
...
2546  lbsims  TRACE  [RMI TCP Connection(7)-127.0.1.1] openjpa.MetaData -
Parsing query "PositionLog.byId".

Then, since the persistence.xml file has
<class>com.lbslogics.ims.model.PositionLog</class> in it, it parses the class
again (it shouldn't, but that's what I could merely come up with how OpenJPA
works). That's when the other message about the query pops up:

3123  lbsims  TRACE  [RMI TCP Connection(7)-127.0.1.1] openjpa.MetaData -
Processing registered persistence-capable class "class
com.lbslogics.ims.model.PositionLog".
...
3134  lbsims  TRACE  [RMI TCP Connection(7)-127.0.1.1] openjpa.MetaData -
Parsing query "PositionLog.byId".
3135  lbsims  WARN   [RMI TCP Connection(7)-127.0.1.1]
openjpa.MetaData - Found duplicate query "PositionLog.byId" in "class
com.lbslogics.ims.model.PositionLog".  Ignoring.

To prevent the double parsing from occuring, remove the class element from the
persistence.xml file and let OpenJPA find the classes (not recommended in Java
EE env and mandatory in Java SE) or add <exclude-unlisted-classes /> element to
the persistence.xml file to tell OpenJPA that listed classes only are to be
managed (highly recommended).

I think it should help avoiding the message - "openjpa.MetaData - Found
duplicate query "PositionLog.byId" in "class
com.lbslogics.ims.model.PositionLog".  Ignoring."

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Reply via email to