I am currently trying to use HibernateOGM 5.0.0 Beta with MongoDB.
In my application i store some kind of meta-objects, who own a Set of DBProperty-Objects (see below) to store its properties and values. To achieve this the DBProperty is a generic abstract class with a generic attribute called "value". For each type of property there is an implementing class.
All classes look the like the one below, only "Value" is of another type (i.e. String, Float, etc.) and are named accordingly.
Code:
@Entity
@DiscriminatorValue("L")
@XmlType
public class DBLongProperty extends DBProperty<Long> {
[...]
@Basic
@Override
@XmlAttribute
public Long getValue() {
return super.getValue();
}
[...]
}
The abstract class has a number of non overriden attributes (part of it inherited from further above in the hierarchy, such as an ID) who are read just finde.
Code:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="Prop_Type")
public abstract class DBProperty<T> extends DBIdentified {
[...]
private T value;
@Transient
@XmlTransient
public T getValue() {
return this.value;
}
[...]
}
When working with HibernateOGM everything is written correctly to the DB but when i try to read an Object (For both nativeQuery and JPQL) all attributes are read except for "value", which returns a NULL. I checked the DB, but the value is set correctly.
When reading a DBLongProperty(or any other implementing class) directly the returned object has the value set correctly.
Has anyone an idea, why this happens?
Kind regards