Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 70784 invoked from network); 1 Apr 2008 01:44:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Apr 2008 01:44:41 -0000 Received: (qmail 46187 invoked by uid 500); 1 Apr 2008 01:44:41 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 46170 invoked by uid 500); 1 Apr 2008 01:44:41 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 46161 invoked by uid 99); 1 Apr 2008 01:44:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 18:44:40 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.252.110.52] (HELO web55806.mail.re3.yahoo.com) (216.252.110.52) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 01 Apr 2008 01:43:59 +0000 Received: (qmail 62879 invoked by uid 60001); 1 Apr 2008 01:44:10 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=xsfxsyLjr7EHU/m9f1CVrdnhAkgEYEFDYhItsyd7MRKKfd58emRaUifVkHmbCvWVbMuQ1Ad1UzG33vkemMTKkYmFT4Hy/ZPEaQdn9NATFWVH1/i13fVsRlwbEGoY92Z/bAnoF0etGbjeA7KtWE5hMgIVUeEtCvt08I24OMfWSRY=; X-YMail-OSG: 5fALJFAVM1nZAhCwFcbJ4O.UFjeC6B9Etqy.HoDoZg9L59307DiPmnkOmvhh_UBnbQteSr9bamtpeiONldxsGAuJKysK3JBvLmF.C5FE0fqZ1q.4GUIG_M7mMC.0K2GwGn5BN7x7CaMOrHHlLXqRt4F_RA-- Received: from [216.101.109.137] by web55806.mail.re3.yahoo.com via HTTP; Mon, 31 Mar 2008 18:44:08 PDT X-Mailer: YahooMailRC/902.40 YahooMailWebService/0.7.185 Date: Mon, 31 Mar 2008 18:44:08 -0700 (PDT) From: Fay Wang Subject: Re: Could not locate metadata (orm.xml) To: users@openjpa.apache.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-1764700556-1207014248=:62695" Message-ID: <104506.62695.qm@web55806.mail.re3.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org --0-1764700556-1207014248=:62695 Content-Type: multipart/alternative; boundary="0-2089630332-1207014248=:62695" --0-2089630332-1207014248=:62695 Content-Type: text/plain; charset=us-ascii Hi Lars, I unzip the file and ran it. I was able to run PCEnhancer but failed to execute your Main.java for the following error message: Exception in thread "main" org.apache.openjpa.persistence.ArgumentException: An error occurred while parsi ng the query filter "select m from MYAPPLICATION.PEOPLETABLE m". Error message: The name "MYAPPLICATION.PEOPLETABLE" is not a recognized entity or identifier. P erhaps you meant Person, which is a close match. Known entity names: [Person] I then changed your query in Main.java to: Query q = em.createQuery("select m from Person m"); It then works fine. The attached is my run.bat to set classpath, compile entity classes, and run PCEnhancer, and execute Main.java. -Fay ----- Original Message ---- From: Lars Vogel To: users@openjpa.apache.org; fyw300@yahoo.com Sent: Monday, March 31, 2008 3:09:14 PM Subject: Re: Could not locate metadata (orm.xml) Hi Fay, yes both are in the same directory. I tried with and without mapping entry in persistence. For reference I attached the content of my source directory. It is a very tiny example If someone wants to test this, please run Main.java. Best regards, Lars 2008/3/31, Fay Wang :Hi Lars, I ran your example as a standalone one. and the PCEnhancer works for me. Here is my persistence.xml: com.ibm.websphere.persistence.PersistenceProviderImpl META-INF/orm.xml datamodel.Person ... and my orm.xml: They are almost identical as yours. Did you put your orm.xml in the same directory as your persistence.xml? Fay --- On Mon, 3/31/08, Lars Vogel wrote: From: Lars Vogel Subject: Re: Could not locate metadata (orm.xml) To: users@openjpa.apache.org Date: Monday, March 31, 2008, 9:46 AM Hi Fay, I don't get the meaining of your comment. Are you saying my example works for you? Are you running it standalone or inside a web container? Best regards, Lars 2008/3/31, Lars Vogel : > > Hi Adam, > > thank you. If I remove the I still get the same error. I > change the header to your header but still no difference. I paste the new > version of my files below. > > Both orm.xml and persistence.xml are in the same directory META-INF. > > Any further advice? > -------------- > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm > http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" > version="1.0"> > >
> > > > > > > > > > > --------------- > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> > > > > > org.apache.openjpa.persistence.PersistenceProviderImpl > > META-INF/orm.xml > > > datamodel.Person > > > > value="jdbc:derby:C:/DerbyDatabases/hellojpa-database9;create=true" /> > value="org.apache.derby.jdbc.EmbeddedDriver" /> > > > > > value="buildSchema" /> > > > > > > > > > > Best regards, Lars > > > 2008/3/31, Adam Hardy : > > > > Hi Lars, > > > > that is a weird error that I haven't seen before - it looks like OpenJPA > > is > > confusing the table name with the class name. > > > > In case it helps, you don't need to reference the orm.xml in the > > persistence.xml. Not sure if it's a problem when you do, try without. > > > > orm.xml looks like it's in the same directory as persistence.xml from > > your > > email. perhaps you should double-check. > > > > my orm.xml header is slightly different: > > > > > > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm > > > > http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" > > version="1.0"> > > > > I do not run the OpenJPA enhancer and you shouldn't need to, but I am > > using the > > OpenJPA v1.1.0 snapshot, not 1.0.x. > > > > > > > > > > > > Lars Vogel on 30/03/08 19:29, wrote: > > > Hi, > > > > > > Can anyone point me to a working standalone example there a a orm.xmlfile > > > is used instead of Annotations? > > > > > > I'm able to build a small example with annotations but if I try the > > same > > > with orm.xml I receive the following error: > > > > > > Exception in thread "main" > error> > > > org.apache.openjpa.persistence.ArgumentException: Could not locate > > metadata > > > for the class using alias "MYAPPLICATION.PEOPLETABLE". This could mean > > that > > > the OpenJPA enhancer or load-time weaver was not run on the type whose > > alias > > > is "MYAPPLICATION.PEOPLETABLE". Registered alias mappings: "{ > > > MYAPPLICATION.PEOPLETABLE=null, Person=[class datamodel.Person]}" > > > > > > > > > I have the following orm.xml > > > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > > > xsi:schemaLocation=" > > http://java.sun.com/xml/ns/persistence/ormorm_1_0.xsd" > > > > > version="1.0"> > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I have the following persistence.xml > > > > > > > > > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0 > > "> > > > > > > > > > > > > > > > > > > > > > > > > org.apache.openjpa.persistence.PersistenceProviderImpl > > > > > > META-INF/orm.xml > > > > > > > > > datamodel.Person > > > > > > > > > > > > > > value="jdbc:derby:C:/DerbyDatabases/hellojpa-database9;create=true" /> > > > > > value="org.apache.derby.jdbc.EmbeddedDriver" /> > > > > > > > > > > > > > > > > > value="buildSchema" /> > > > > > > > > > > > > > > > > > > > > Like movies? Here's a limited-time offer: Blockbuster Total Access for one month at no cost. ____________________________________________________________________________________ Special deal for Yahoo! users & friends - No Cost. Get a month of Blockbuster Total Access now http://tc.deals.yahoo.com/tc/blockbuster/text3.com --0-2089630332-1207014248=:62695 Content-Type: text/html; charset=us-ascii
Hi Lars,
     I unzip the file and ran it. I was able to run PCEnhancer but failed to execute your Main.java for the following error message:

Exception in thread "main" <openjpa-1.1.0-SNAPSHOT-runknown nonfatal user error>
 org.apache.openjpa.persistence.ArgumentException: An error occurred while parsi
ng the query filter "select m from MYAPPLICATION.PEOPLETABLE m". Error message:
The name "MYAPPLICATION.PEOPLETABLE" is not a recognized entity or identifier. P
erhaps you meant Person, which is a close match. Known entity names: [Person]

   I then changed your query in Main.java to:
        Query q = em.createQuery("select m from Person m");
It then works fine. The attached is my run.bat to set classpath, compile entity classes, and run PCEnhancer, and execute Main.java.

-Fay



----- Original Message ----
From: Lars Vogel <lars.vogel@googlemail.com>
To: users@openjpa.apache.org; fyw300@yahoo.com
Sent: Monday, March 31, 2008 3:09:14 PM
Subject: Re: Could not locate metadata (orm.xml)

Hi Fay,

yes both are in the same directory. I tried with and without mapping entry in persistence. For reference I attached the content of my source directory. It is a very tiny example

If someone wants to test this, please run Main.java.

Best regards, Lars


2008/3/31, Fay Wang <fyw300@yahoo.com>:
Hi Lars,
    I ran your example as a standalone one. and the PCEnhancer works for me.  Here is my persistence.xml:

    <persistence-unit name="person">
      <provider>com.ibm.websphere.persistence.PersistenceProviderImpl</provider>
      <mapping-file>META-INF/orm.xml</mapping-file>
      <class>datamodel.Person</class>
      <properties>
        <property name="openjpa.jdbc.DBDictionary" value=""/>
...


and my orm.xml:
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/ormorm_1_0.xsd"
    version="1.0">
    <entity class="datamodel.Person">
      <table name="MYAPPLICATION.PEOPLETABLE"/>
        <attributes>
            <id name="id" />
            <basic name="firstName" />
            <basic name="lastName" />
            <transient name="nonsenseField" />
        </attributes>
    </entity>
</entity-mappings>

They are almost identical as yours. Did you put your orm.xml in the same directory as your persistence.xml?

Fay



--- On Mon, 3/31/08, Lars Vogel <lars.vogel@googlemail.com> wrote:
From: Lars Vogel <lars.vogel@googlemail.com>
Subject: Re: Could not locate metadata (orm.xml)
To: users@openjpa.apache.org
Date: Monday, March 31, 2008, 9:46 AM


Hi Fay,

I don't get the meaining of your comment. Are you saying my example works
for you? Are you running it standalone or inside a web container? Best
regards, Lars

2008/3/31, Lars Vogel <lars.vogel@googlemail.com>:

>
> Hi Adam,
>
> thank you. If I remove the <mapping-file> I still get the same
error. I
> change the header to your header but still no difference. I paste the new
> version of my files below.

>
> Both orm.xml and persistence.xml are in the same directory META-INF.
>
>
Any further advice?
> --------------
>
> <?xml version="1.0" encoding="UTF-8"?>

> <entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"

> version="1.0">
> <entity class="datamodel.Person">
> <table name="MYAPPLICATION.PEOPLETABLE"/>
> <attributes>
> <id name="id" />

> <basic name="firstName" />
> <basic name="lastName" />
> <transient name="nonsenseField" />
> </attributes>

> </entity>
> </entity-mappings>
>
> <?xml version="1.0" encoding="UTF-8"?>
> ---------------
>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"

> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">

>
> <persistence-unit name="people"
transaction-type="RESOURCE_LOCAL">
>
> <provider>
> org.apache.openjpa.persistence.PersistenceProviderImpl

> </provider>
> <mapping-file>META-INF/orm.xml</mapping-file>
>
> <!-- We must enumerate each entity in the persistence unit
-->
> <class>datamodel.Person</class>

>
> <properties>
> <property name="openjpa.ConnectionURL"
>
>
value="jdbc:derby:C:/DerbyDatabases/hellojpa-database9;create=true"
/>

> <property name="openjpa.ConnectionDriverName"
>
value="org.apache.derby.jdbc.EmbeddedDriver"
/>
> <property name="openjpa.ConnectionUserName"

value="" />
> <property name="openjpa.ConnectionPassword"
value="" />
>
> <!--
> Automatically create tables in the database

> for entities. Not for production use
> -->
> <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema" />

>
> </properties>
> </persistence-unit>
>
> </persistence>
>
>
>
>
> Best regards, Lars
>
>
> 2008/3/31, Adam Hardy <adam.sql@cyberspaceroad.org>:

> >
> > Hi Lars,
> >
> > that is a weird error that I haven't seen before - it looks like
OpenJPA
> > is
>
> confusing the table name with the class name.
> >

> > In case it helps, you don't need to reference the orm.xml in the
> > persistence.xml. Not sure if it's a problem when you do, try
without.
> >
> > orm.xml looks like it's in the same directory as persistence.xml

from
> > your
> > email. perhaps you should double-check.
> >
> > my orm.xml header is slightly different:
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>

> >
> > <entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"

> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >

xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> >
> > http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"

> > version="1.0">
> >
> > I do not run the OpenJPA
enhancer and you shouldn't need to, but
I am
> > using the
> > OpenJPA v1.1.0 snapshot, not 1.0.x.

> >
> >
> >
> >
> >
> > Lars Vogel on 30/03/08 19:29, wrote:
> > > Hi,
> > >
> > > Can anyone point me to a working standalone example there a a

orm.xmlfile
> > > is used instead of Annotations?
> > >
> > > I'm able to build a small example with annotations but if I
try the
> > same
> > > with orm.xml I receive the following error:

> > >
> > > Exception in thread "main"
<openjpa-1.0.2-r420667:627158 fatal user
> > error>
> > > org.apache.openjpa.persistence.ArgumentException: Could not

locate
> > metadata
> > > for the class using alias "MYAPPLICATION.PEOPLETABLE".
This could mean
> > that
>
> > the OpenJPA enhancer or load-time weaver was not run on the type

whose
> > alias
> > > is "MYAPPLICATION.PEOPLETABLE". Registered alias
mappings: "{
> > > MYAPPLICATION.PEOPLETABLE=null, Person=[class
datamodel.Person]}"
> > >

> > >
> > > I have the following orm.xml
> > >
> > > <entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"

> > >
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >

> > > xsi:schemaLocation="
> > http://java.sun.com/xml/ns/persistence/ormorm_1_0.xsd"

> >
> > > version="1.0">
> > > <entity class="datamodel.Person">
> > > <table name="MYAPPLICATION.PEOPLETABLE"/>
> > > <attributes>

> > > <id name="id" />
> >
> <basic name="firstName" />
> > > <basic name="lastName" />
> > > <transient name="nonsenseField" />

> > > </attributes>
> > > </entity>
> > > </entity-mappings>
> > >
> > > I have the following persistence.xml
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>

> > > <!--
> > > Licensed to the Apache Software Foundation (ASF) under one
> > > or more contributor license agreements. See the NOTICE file
> > > distributed with this work for additional information

> > > regarding copyright ownership. The ASF licenses this file
> > > to you under the Apache License, Version 2.0 (the
> > > "License"); you may not use this file except

in
compliance
> > > with the License. You may obtain a copy of the License at
> > >
> > > http://www.apache.org/licenses/LICENSE-2.0

> > >
> > > Unless required by applicable law or agreed to in writing,
> > > software distributed under the License is distributed on an
> > > "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF

ANY
> > > KIND, either express or implied. See the License for the
> > > specific language governing permissions and limitations
> > > under the License.
> > > -->

> > > <persistence
xmlns="http://java.sun.com/xml/ns/persistence"
> > >

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0
> > ">

> > >
> > > <!--
> > > A persistence unit is a set
of listed persistent
entities as
> > well
> > > the configuration of an EntityManagerFactory. We

configure
> > each
> > > example in a separate persistence-unit.
> > > -->
> > > <persistence-unit name="people"
transaction-type="RESOURCE_LOCAL">

> > >
> > > <!--
> > > The default provider can be OpenJPA, or some other
> > product.
> > > This element is optional if OpenJPA is the only JPA

> > provider
> > > in the current classloading environment, but can be
> > specified
> > > in cases where there are multiple JPA
implementations
> > available.

> > > -->
> > >
> > > <provider>
> > >

org.apache.openjpa.persistence.PersistenceProviderImpl
> > > </provider>

> > >
<mapping-file>META-INF/orm.xml</mapping-file>
> > >
> > > <!-- We must enumerate each entity in the persistence
unit -->
> > > <class>datamodel.Person</class>

> > >
> > > <properties>
> > > <property name="openjpa.ConnectionURL"
> > >
> > >
value="jdbc:derby:C:/DerbyDatabases/hellojpa-database9;create=true"

/>
> > > <property
name="openjpa.ConnectionDriverName"
> > >
value="org.apache.derby.jdbc.EmbeddedDriver" />
> > > <property

name="openjpa.ConnectionUserName" value="" />
> > >
<property
name="openjpa.ConnectionPassword" value="" />
> > >
> > > <!--

> > > Tell OpenJPA to automatically create tables in
the
> > database
> > > for entities. Note that this should be disabled
when
> > > running against a production database, since you

> > probably
> > > don't want to be altering the schema at
runtime.
> > > -->
> > > <property
name="openjpa.jdbc.SynchronizeMappings"

> > > value="buildSchema" />
> > >
> > > </properties>
> > > </persistence-unit>
> > >
> > > </persistence>

> >
> >
>


Like movies? Here's a limited-time offer: Blockbuster Total Access for one month at no cost.



Like movies? Here's a limited-time offer: Blockbuster Total Access for one month at no cost. --0-2089630332-1207014248=:62695-- --0-1764700556-1207014248=:62695--