Hi,
I want an embeddable abstract class that doesn't must contains all the subclass properties.
Is it possible?
If yes, which annotations does I need?
If no, is making the embeddable as an entity the only solution?
Let's take the following example:
Code:
@Entity
public class Page implements Serializable {
@Id
@GeneratedValue
@Column(name = "id", nullable = false)
private Long id;
@Embedded
private AbstractContent content;
[...]
}
Code:
@Embeddable
public abstract class AbstractContent implements Serializable {
[...]
}
Code:
public abstract class ValidContent extends AbstractContent {
@Column(name = "content")
private String content;
[...]
}
Code:
public abstract class ErrorContent extends AbstractContent {
@Column(name = "error")
private String error;
[...]
}
Maybe it's not an hibernate problem but I cannot go far away while my DBUnit Test complains about fields from subclass that - for the framework - doesnt' exists.
Code:
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
<page id="1" content="blabla" />
<page id="1" error="blabla" />
[...]
</dataset>
Thanks to everyone, especially the one who will solve my problem ^^