Re: enhancing entity which is a subclass

2009-07-29 Thread pdd

Thanks a lot Rick. It worked!


Rick Curtis wrote:
> 
> After looking at the spec, it looks like you should be using the
> mapped-superclass XML descriptor on the UserModelBaseImpl class and
> com.example.model.impl.UserModelImpl needs to be added to your list of
> persistent classes.  See section 2.11 - 'Inheritance' for more details.
> Let me know how it goes!
> 
> -Rick
> 

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


Re: enhancing entity which is a subclass

2009-07-27 Thread Rick Curtis

After looking at the spec, it looks like you should be using the
mapped-superclass XML descriptor on the UserModelBaseImpl class and
com.example.model.impl.UserModelImpl needs to be added to your list of
persistent classes.  See section 2.11 - 'Inheritance' for more details. Let
me know how it goes!

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


Re: enhancing entity which is a subclass

2009-07-27 Thread pdd

Here are the relevant snippets.

persistence.xml fragment
-
  


META-INF/orm.xml

true

  


  
   
org.apache.openjpa.persistence.PersistenceProviderImpl
com.example.model.impl.UserModelImpl
  

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
--



PROPERTY



com.example.model.impl



















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-tp612p3334036.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: enhancing entity which is a subclass

2009-07-27 Thread Rick Curtis
Can you post snippets of your Entities and your persistence.xml file?

-Rick

On Mon, Jul 27, 2009 at 7:47 AM, pdd  wrote:

>
> Everything works with EclipseLink and TopLink but fails with OpenJPA.
>
> Tried with runtime as well as build time enhancement. The problem is the
> entity class is a subclass. In this test case, it is an empty class which
> inherits everything from the base class UserModelBaseImpl.
>
> ...
> ...
> ...
>  [openjpac] Caused by: java.io.IOException: org.xml.sax.SAXException:
> file:/TestCase/build/web/WEB-INF/classes/META-INF/orm.xml [Location: Line:
> 19, C: 18]: Could not find property/field with the name "id" in type
> "com.example.model.impl.UserModelImpl".[java.lang.NoSuchMethodException:
> com.example.model.impl.UserModelImpl.getId()]
> ...
> ...
> ...
> Caused by: java.lang.NoSuchMethodException:
> com.example.model.impl.UserModelImpl.getId()
>at java.lang.Class.getDeclaredMethod(Class.java:1937)
>at
> org.apache.openjpa.lib.util.J2DoPrivHelper$8.run(J2DoPrivHelper.java:288)
>at java.security.AccessController.doPrivileged(Native Method)
>at
>
> org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parseField(XMLPersistenceMetaDataParser.java:1105)
>... 46 more
>
> The getId method exists in the parent class. In fact all methods/fields are
> defined in the parent base implementation. The orm.xml specifies PROPERTY
> access.
>
> Is this is a bug?
>
>
> --
> View this message in context:
> http://n2.nabble.com/enhancing-entity-which-is-a-subclass-tp612p612.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>


enhancing entity which is a subclass

2009-07-27 Thread pdd

Everything works with EclipseLink and TopLink but fails with OpenJPA.

Tried with runtime as well as build time enhancement. The problem is the
entity class is a subclass. In this test case, it is an empty class which
inherits everything from the base class UserModelBaseImpl.

...
...
...
 [openjpac] Caused by: java.io.IOException: org.xml.sax.SAXException:
file:/TestCase/build/web/WEB-INF/classes/META-INF/orm.xml [Location: Line:
19, C: 18]: Could not find property/field with the name "id" in type
"com.example.model.impl.UserModelImpl".[java.lang.NoSuchMethodException:
com.example.model.impl.UserModelImpl.getId()]
...
...
...
Caused by: java.lang.NoSuchMethodException:
com.example.model.impl.UserModelImpl.getId()
at java.lang.Class.getDeclaredMethod(Class.java:1937)
at
org.apache.openjpa.lib.util.J2DoPrivHelper$8.run(J2DoPrivHelper.java:288)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.openjpa.persistence.XMLPersistenceMetaDataParser.parseField(XMLPersistenceMetaDataParser.java:1105)
... 46 more

The getId method exists in the parent class. In fact all methods/fields are
defined in the parent base implementation. The orm.xml specifies PROPERTY
access.

Is this is a bug?


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