Here are the relevant snippets.

persistence.xml fragment
-----------------------------
  <persistence-unit name="UserAdmin" transaction-type="RESOURCE_LOCAL">
    <!-- Explicitly define mapping file path, else Hibernate won't find the
default -->
    <non-jta-data-source/>
    <mapping-file>META-INF/orm.xml</mapping-file>
    <!-- Prevent annotation scanning. In this app we are purely driven by
orm.xml -->
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties/>
  </persistence-unit>


  <persistence-unit name="enhance" transaction-type="RESOURCE_LOCAL">
   
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>com.example.model.impl.UserModelImpl</class>
  </persistence-unit>

Entity class UserModelImpl
------------------------------
package com.example.model.impl;

public class UserModelImpl extends UserModelBaseImpl {

}

UserModelBaseImpl.java
---------------------------
package com.example.model.impl;

import com.example.model.UserModel;

public class UserModelBaseImpl implements UserModel {
        private long id = -1;
        private String firstName;
        private String lastName;
        private int age;
        private double wages;
        private boolean active;

        public int getAge() {
                return age;
        }

        public String getFirstName() {
                return firstName;
        }

        public long getId() {
                return id;
        }

...
...
...
        public void setAge(int age) {
                this.age = age;
        }

        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }

        public void setId(long id) {
                this.id = id;
        }
...
...
...
}

orm.xml
----------
        <persistence-unit-metadata>
                <xml-mapping-metadata-complete/>
                <persistence-unit-defaults>
                        <access>PROPERTY</access>
                </persistence-unit-defaults>
        </persistence-unit-metadata>

        <package>com.example.model.impl</package>

        <entity class="UserModelImpl">
                <table name="User"/>
                <attributes>
                        <id name="id">
                                <generated-value strategy="IDENTITY"/>
                        </id>
                        <basic name="firstName"/>
                        <basic name="lastName"/>
                        <basic name="age"/>
                        <basic name="wages"/>
                        <basic name="active">
                                <column name="ACTIVE_"/>
                        </basic>
                        <transient name="new"/>
                </attributes>
        </entity>


Rick Curtis wrote:
> 
> Can you post snippets of your Entities and your persistence.xml file?
> 
> -Rick
> 

-- 
View this message in context: 
http://n2.nabble.com/enhancing-entity-which-is-a-subclass-tp3333612p3334036.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to