Note that there are some explanatory texts on larger screens.

plurals
  1. POeclipselink inheritance implementation
    primarykey
    data
    text
    <p>I am trying to implement ElcipseLink JPA2.0 for inheritance in my project. Can't use annotation. only xml mappings. </p> <p>Here is my code. public class DefaultEntity {</p> <pre><code>} public class SpecialEntity extends DefaultEntity { public String name; public int age; } public class AnotherSplEntity extends DefaultEntity { long ts; String pkey; } public class MyPersistableEntity { public DefaultEntity de; public void setMyPersistableEntity(DefaultEntity de) { // any subclass can be assigned here. this.de = de } </code></pre> <p>here is my ORM.xml </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;entity-mappings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" version="2.3"&gt; &lt;persistence-unit-metadata&gt; &lt;exclude-default-mappings /&gt; &lt;/persistence-unit-metadata&gt; &lt;entity class="MyPersistableEntity"&gt; &lt;attributes&gt; &lt;one-to-one name="de"&gt; &lt;cascade&gt; &lt;cascade-all /&gt; &lt;/cascade&gt; &lt;/one-to-one&gt; &lt;/attributes&gt; &lt;/entity&gt; &lt;mapped-superclass class="DefaultEntity"&gt; &lt;attributes&gt; &lt;id name="id" attribute-type="long"&gt; &lt;generated-value strategy="SEQUENCE" /&gt; &lt;/id&gt; &lt;/attributes&gt; &lt;/mapped-superclass&gt; &lt;entity class="SpecialEntity" &gt; &lt;attributes&gt; &lt;id name="id" attribute-type="long"&gt; &lt;generated-value strategy="SEQUENCE" /&gt; &lt;/id&gt; &lt;basic name="name" attribute-type="String" /&gt; &lt;basic name="age" attribute-type="int" /&gt; &lt;/attributes&gt; &lt;/entity&gt; &lt;/entity-mappings&gt; </code></pre> <p>I keep getting " uses a non-entity [class DefaultEntity] as target entity in the relationship attribute [field de]"</p> <p>how to make EclipseLink recognize the actual class assigned and use that mapping?</p> <p>any ideas? foremost, can it be done using EcliseLink?</p> <p>thanks Gopi</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload