But I could not find anything here to make that modification, so I am opening an issue to it.
The solution Fneuch proposed was as follow:
{quote}
Hi Guys,
First of all, sorry for any english mistake.
Secondly, is it me or ODM doesn't allow hierarchical inheritance? I've made a little change and it seems to work fine.
In the constructor of class ObjectMetaData I've replaced:
Code:
{code}
//Field[] fields = clazz.getDeclaredFields();
{code}
by
Code:
{code}
ArrayList fieldsTemp = new ArrayList<>();
fieldsTemp.addAll(Arrays.asList(clazz.getDeclaredFields()));
Class<?> classTemp = clazz.getSuperclass();
while(!classTemp.equals(Object.class)) {
fieldsTemp.addAll(Arrays.asList(classTemp.getDeclaredFields()));
classTemp = classTemp.getSuperclass();
}
// Get field meta-data - the @Attribute annotation
Field[] fields = fieldsTemp.toArray(new Field[fieldsTemp.size()]);
{code}
Can you correct me here? Is there something that I didn't see? Because on create, find, delete I've seen no problem with my test... I didn't checkout project to made a full change, just replace the class in my own project for testing.
How can I ask for that feature in a future version? Thanks for any information!
Original Reporter: demetriusjube Environment: Not Specified Version: 2.0.2 Migrated From: https://jira.spring.io//browse/LDAP-306 I was trying do use some inheritance when using ODM. Looking in the Internet, I found out this thread: http://forum.spring.io/forum/spring-projects/data/ldap/129952-permit-odm-to-allow-inheritance
But I could not find anything here to make that modification, so I am opening an issue to it.
The solution Fneuch proposed was as follow: {quote} Hi Guys,
First of all, sorry for any english mistake.
Secondly, is it me or ODM doesn't allow hierarchical inheritance? I've made a little change and it seems to work fine.
In the constructor of class ObjectMetaData I've replaced:
Code: {code} //Field[] fields = clazz.getDeclaredFields(); {code} by
Code: {code} ArrayList fieldsTemp = new ArrayList<>();
fieldsTemp.addAll(Arrays.asList(clazz.getDeclaredFields()));
Class<?> classTemp = clazz.getSuperclass();
while(!classTemp.equals(Object.class)) { fieldsTemp.addAll(Arrays.asList(classTemp.getDeclaredFields())); classTemp = classTemp.getSuperclass();
} // Get field meta-data - the @Attribute annotation Field[] fields = fieldsTemp.toArray(new Field[fieldsTemp.size()]); {code} Can you correct me here? Is there something that I didn't see? Because on create, find, delete I've seen no problem with my test... I didn't checkout project to made a full change, just replace the class in my own project for testing.
How can I ask for that feature in a future version? Thanks for any information!
Sylvain aka Fneuch {quote}