G
guigouz
Hi, I'm trying to build an entity class that has another class as a
field, but I don't want to generate a relationship between them.
Instead i wanted to serialize the contents of the child class as a
String to store on the database. Is it possible ?
Right now, I'm doing it like
class SomeClass {
private String content;
@Transient
private transient Details details = null;
public synchronized Details getDetails() {
if(details == null) this.details = new Details(content);
else
return this.details;
}
@PrePersist
public void setContent() {
if(this.details != null) this.content = this.details.toString();
}
}
Any better idea ?
Thanks a lot
gui
field, but I don't want to generate a relationship between them.
Instead i wanted to serialize the contents of the child class as a
String to store on the database. Is it possible ?
Right now, I'm doing it like
class SomeClass {
private String content;
@Transient
private transient Details details = null;
public synchronized Details getDetails() {
if(details == null) this.details = new Details(content);
else
return this.details;
}
@PrePersist
public void setContent() {
if(this.details != null) this.content = this.details.toString();
}
}
Any better idea ?
Thanks a lot
gui