Jacek,

thank you for diving into this. I added the following node to my persistence.xml right
after the <classes> - List:

<exclude-unlisted-classes >true</exclude-unlisted-classes>

It seems that the "duplicate query" warning stays - did  I add it the wrong way?

hans

Am Mittwoch, den 18.04.2007, 00:16 +0200 schrieb Jacek Laskowski:
On 4/17/07, Hans J. Prueller <hans.prueller@gmx.net> 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