openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: ... is not a recognized entity or identifier.
Date Wed, 27 May 2009 12:49:06 GMT
On Tue, May 26, 2009 at 4:51 PM, Pinaki Poddar <ppoddar@apache.org> wrote:

>
> Hi Mike,
> > We could (should ?) scan the classpath if the alias isn't available and
> > exclude-unlisted-classes == false. It could be expensive but it's better
> > than a misleading error message like this one..
>
>   We should. Perhaps with a
> openjpa.ScanClasspathForEntityWhenQueryAliasNotDetecetd=true|false. But
> what
> is the scope of such scan? And what exactly should be the strategy for a
> fast scan?


I'd guess this is why we don't do something like this already - it's not a
trivial solution.

I'd propose something like this (assuming the problem still exists after we
fix the issue Michael Simons mentioned) :
openjpa.UnlistedEntityDetection = none | complete | partial.

none == behavior we have today.
complete == scan all @Entities on the classpath (and anything in orm.xml).
Exception as today if the alias is not found.
partial == scan until we find the missing alias - then stop. Exception as
today if the alias is not found.

We've spoken about initializing the MetaDataRepository eagerly in the past
(1 pass, avoid locking, re-scanning, etc.). This approach wouldn't be the
same but it'd be related.

Also do you know of any place in OpenJPA (or elsewhere) that employs a full
> classpath scan?
>

Not off the top of my head. I would think that the PCEnhancer would do
something similar if no classes were listed in persistence.xml though.


-mike


>
>
> Michael Dick wrote:
> >
> > Does listing the types in persistence.xml also resolve the problem?
> > Specifying them on the MetaDataFactory should exercise the same path as :
> > <persistence-unit name="xxx">
> >     <class>net.uniopt.domain.actual.ActualAction</class>
> >     . . .
> > </persistence-unit>
> >
> > Possible explanation (more for dev@openjpa than users@openjpa) :
> > Enhanced classes have a static initializer which "registers" the type
> with
> > OpenJPA the first time it's loaded (creating and instance or running
> > em.find()). If the type isn't listed or initialized we don't know where
> > look
> > for the alias in your JPQL query.
> >
> > We could (should ?) scan the classpath if the alias isn't available and
> > exclude-unlisted-classes == false. It could be expensive but it's better
> > than a misleading error message like this one..
> >
> > -mike
> >
> > On Tue, May 26, 2009 at 12:27 PM, Kevin Sutter <kwsutter@gmail.com>
> wrote:
> >
> >> At least you have verified that the problem is related to the populating
> >> of
> >> the metadata repository.  Thanks for the information.
> >>
> >> Kevin
> >>
>

<snip>


>
> -----
> Pinaki Poddar                      http://ppoddar.blogspot.com/
>
> http://www.linkedin.com/in/pinakipoddar
> OpenJPA PMC Member/Committer
> JPA Expert Group Member
> --
> View this message in context:
> http://n2.nabble.com/...-is-not-a-recognized-entity-or-identifier.-tp2969391p2977501.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message