openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: Open JPA error-Could not locate metadata for the class using alias
Date Wed, 25 Apr 2007 09:15:00 GMT
So, I got things working (well, to the point where the list.get(1) call
failed since my db was empty). I had to do the following to your code to
make things work:

1. changed back to @MappedSuperclass in generated dir

2. added all the superclasses to persistence.xml

3. commented out Zzzupdates -- GregorianCalendar is not a legal id type

4. renamed a bunch of columns and table names to not be reserved
keywords in Derby

5. fixed the GeneratedValue usage

6. renamed ....generated.Article to ....generated.ArticleBase

I think that if you do 1, 2, 3, 5, and 6, you should be in good shape.

FYI, I was getting a very cryptic error when the system had a
@MappedSuperclass called Article and an @Entity called Article. This is
a bug in OpenJPA -- mapped superclasses should not have aliases. You can
work around it by adding some postfix (as in ArticleBase) to all your
mapped superclasses. Certainly this is something that we should fix,
though.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc.
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: tbee [mailto:tbee@tbee.org] 
> Sent: Wednesday, April 25, 2007 1:06 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: Open JPA error-Could not locate metadata for the 
> class using alias
> 
> 
> 
> 
> Patrick Linskey wrote:
> > 
> > Ok... the problem is that OpenJPA requires that you run the OpenJPA 
> > class enhancer over your classes (or run in a container environment 
> > such as an appserver or Spring, which can do 
> class-load-time processing).
> > 
> > The other problem is that the error message is really bad, 
> in that it 
> > doesn't suggest that as a cause, and in that the message 
> > stringification is deferred, causing the "Article=null" 
> negative-cache misdirection.
> > I've changed the error message and toString() logic.
> > 
> > Meanwhile, I got the following when running the enhancer on your
> > classes:
> > 
> > <0.0.0 fatal user error> org.apache.openjpa.util.MetaDataException:
> > "nl.reinders.bm.generated.License.iLicensenr" declares 
> generator name 
> > "licensenr", but uses the AUTO generation type.  The only valid 
> > generator names under AUTO are "uuid-hex" and "uuid-string".
> > 
> > I changed the @GeneratedValue annotation to specify that it's using 
> > the 'GenerationType.TABLE' strategy, but then I ran into 
> problems with 
> > classes that had compound identity but didn't specify an @IdClass.
> > 
> 
> 
> Ok, the first part I get; actually very logical. 
> 
> The generator I follow also, I should alter the RevEng to 
> generate type=table. Ok. But the compound identity I'm not 
> quite following. If all is well then I should be generating 
> "*PK.java" classes for tables with more than one field in the 
> PK and the corresponding @IdClass. Maybe the quick change to 
> "@Entity extends @Entity" has a bug, now that I think of it, 
> the @IdClass may refer to a PK class that actually is in the 
> generated package.
> Could you elaborate?
> 
> --
> View this message in context: 
> http://www.nabble.com/Open-JPA-error-Could-not-locate-metadata
> -for-the-class-using-alias-tf3561516.html#a10176178
> Sent from the open-jpa-dev mailing list archive at Nabble.com.
> 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA
Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,
 copyrighted  and/or legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete it.

Mime
View raw message