Hi have two entities: one for the master (a document)
@Inheritance(strategy = InheritanceType.JOINED)
public class DocumentStandard implements Serializable {
private static final long serialVersionUID = -712220124306015698L;
@Column(name = "number")
private Integer number;
...
}
and one for the rows
@Inheritance(strategy = InheritanceType.JOINED)
public class RowStandard<D extends DocumentStandard> implements Serializable {
private static final long serialVersionUID = -8343803021263172062L;
@JoinColumn(name = "iddoc", nullable = false)
@ManyToOne(targetEntity = DocumentStandard.class, fetch = FetchType.EAGER)
private D doc;
...
}
These are my template classes. I extend these classes for particular documents:
-
DocA extends DocumentStandard
-
RowA extends RowStandard
There is a way to specify that doc
in rowA is of type DocA ?
Why I need this detail?
Because I've a json deserializer (jackson) that use java reflection for sanitarizing my data, for instance change all enums received as object 'enum' :{ 'text': 'Open', 'value':'O'}
in 'enum':'O'
.
I do it reading all fields that are entities, for example in RowA i find doc of type DocumentStandard. So, I search for enums in the DocumentStandard class and correct the relative json. But if the enum is in DocA, i don't find it.
How can i get with reflection the real type of doc field?
Aucun commentaire:
Enregistrer un commentaire