openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject Re: Named query created in error
Date Thu, 19 Apr 2007 14:56:53 GMT
On 4/19/07, Phill Moran <pjmoran@rogers.com> wrote:
> Thanks Jacek,
>
> Store is annotated with @Entity:

That might imply an incorrect behaviour of OpenJPA. I doubt if I can
help more than just a spec guidance ;-) I'll have to set up the
environment to reproduce the issue as OpenJPA doesn't seem to fail
with Derby and my simple test case.

I hope someone from the OpenJPA team will chime in and provide some
additional hints.

> I thought I needed to add the class names to persistence.xml to have them
> post-processed.

What do you mean by "post-processed". There's no notion of
"post-processing" in JPA.

persistence.xml is a configuration file for persistence units (there
can be more than one in a single persistence.xml file). Each and every
PU is distinguished by its name (unique in the whole application).
There's plenty of work to do for a jpa provider to set up a PU - see
the spec's chapter 7. Container and Provider Contracts for Deployment
and Bootstrapping. One of the tasks is to find all of the persistence
classes (aka entities). Depending on your environment - Java SE or
Java EE - the <class> element may be required.

The spec reads in "6.2.1.6 mapping-file, jar-file, class,
exclude-unlisted-classes" page 138:

A list of all named managed persistence classes must be specified in Java SE
environments to insure portability. Portable Java SE applications
should not rely on the other mechanisms described here to specify the
managed persistence classes of a persistence unit.

> I recognized (since using java agent right now) they are all
> looked at for persistence candidacy but figured this would be needed for compile
> time processing that I would switch to later. Let me know if I am way off here.

That's another thing. To let a jpa provider manage persistence classes
(entities) they might  be enhanced at build- or run-time. It's a
choice you make when you run your application. Under a heavy load
every second might be of great value so the sooner the classes are
enhanced the better or else it might incur performance penalty. With
Java you can process classes while they're loaded and enhance them to
add capabilities like manageability.

> Also must I list all other classes in the <exclude-unlisted-classes> section or
> can I simply list add <exclude-unlisted-classes/> after my listed classes. -

Add <exclude-unlisted-classes> and give it a go. You should see the
Ignoring. warning message go away.

> Clearly I am uncertain to the full purpose of this file

persistence.xml? That's the most important file in the whole jpa
application of yours so treat it gently and with great care so it
won't cause troubles ;-) Read about it in the spec - 6.2 Persistence
Unit Packaging page 134. It's easy to read so highly recommended to
read (before you crash after struggling with setting up OpenJPA ;-))

Jacek

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

Mime
View raw message