[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] How to store a inner bean in XML format
|
I've found a perfect fit for my case: I've wrote a BeanToXmlTypeConverter.
Examples can be found here:
https://wiki.eclipse.org/EclipseLink/Release/2.5/JPA21#A_Converter_annotation_example
It started to work in instant 0.
Thanks,
Atenciosamente,
Edson Carlos Ericksson Richter
Em 05/01/2016 11:19, Edson Richter escreveu:
Dear friends,
I would like to store a bean in XML format in a text field in my
database.
For example, consider the following custom Map implementation:
class MyBean implements Serializable {
private String someKey;
private String someValue;
... constructor, getters and setters as usual
}
@XmlRootElement
class MyBeanMap implements Serializable {
@XmlElement
private MyBean [] values = new MyBean[20];
... all getters and setters as usual
}
Now I would like to have a persistent class
@Entity
class MyWork implements Serializable {
@Id
private Id;
private MyBeanMap myMap = new MyBeanMap();
... all getters and setteras as usual
}
How can I make the "myMap" variable be stored as XML Text in the
"myMap" column in database?
I know I can store it as separate table using @Collections et al, but
this time I would like to get it more flexible using XML for
compatibility with other tool.
Is there any other way than scanning all object tree and
marshalling/unmarshalling it myself?
Thanks,