cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Schwarz <frank.schw...@gmx.de>
Subject Using JPA orm.xml with Cayenne3M3
Date Fri, 14 Mar 2008 09:12:21 GMT
Hi,

is it possible to declare mappings in a JPA conform orm.xml file with 
Cayenne3M3. Unfortunately, I have not been successful so far.

---%<--- META-INF/persistence.xml ----
<?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"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
        <provider>org.apache.cayenne.jpa.Provider</provider>
        <mapping-file>META-INF/orm.xml</mapping-file>
        <properties>
...
        </properties>
    </persistence-unit>
</persistence>

---%<--- META-INF/orm.xml ----
<?xml version="1.0"?>
<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="oopex.cayenne3.jpax.usecases.model.Person" 
name="Person" access="FIELD">
        <table name="PERSON" />
        <attributes>
            <id name="id">
                <generated-value strategy="SEQUENCE" />
            </id>
        </attributes>
    </entity>
</entity-mappings>

The error message is:
Exception in thread "main" java.lang.IllegalArgumentException: entity 
must be Persistent: oopex.cayenne3.jpax.usecases.model.Person
        at 
org.apache.cayenne.jpa.TypeCheckingEntityManager.checkEntityType(TypeCheckingEntityManager.java:64)
        at 
org.apache.cayenne.jpa.TypeCheckingEntityManager.persist(TypeCheckingEntityManager.java:150)
        at oopex.cayenne3.jpax.usecases.HalloWorldMain.insert(Unknown 
Source)
        at oopex.cayenne3.jpax.usecases.HalloWorldMain.main(Unknown Source)

Kind regards,
Frank

Mime
View raw message