I'm using BeanUtils.copyProperties to copy the entire content of one object into another that inherit from it.
Here is the context, the domain object from which the values are copied contains a Set of objects of custom type Xref. That custom type has an embedded class with various fields of various class types.
For some reason one of the field from an object encapsulated within the embedded object does not get copied over. But most everything else I need do get copied over.
With an example:
class Source {
private Set<Xref> xref;
...
}
class Xref {
...
public static class primaryKey {
...
private MyObj obj;
}
}
class MyObj {
private Integer id;
...
}
Using those names if I try to use BeanUtils.copyProperties to copy the content of a "Source" object into a "SourceExtended" object the value of source.xrefs.get(0).getPrimaryKey().getObj().getId() does not get copied over. In the original object it has a value but in the target object it's null...
Any idea why???
Thank you.