I am using the 3.2.6 release of Hibernate Core, the 3.3.2 release of the EntityManager, and the 3.3.1 release of Annotations.
I have an interesting problem with mapping several objects with single table inheritance:
I have the following objects:
Code:
@Entity
@Table(name="TEST_TABLE")
@DiscriminatorColumn(name="COL_1")
public abstract class ParentObject
{
@Id
@Column(name="COL_2")
private String code = null;
@Column(name="COL_3")
private String name = null;
.....
}
@Entity
@DiscriminatorValue(value="13")
public class ChildObject
extends ParentObject
{
@Column(name="COL_4")
private String extraInfo = null;
.....
}
This works very well, except for one problem: In some cases the "code" value in TEST_TABLE is blank (not null, just a blank string). In those cases, I don't want them to be considered valid ChildObjects and I need a way to discriminate against them.
Can somebody suggest a way that I can do that? I've looked at DiscriminatorFormula, but I can't find enough examples to understand how it might help me.
I'm very willing to go a little outside the box with this and use hibernate propriatary extensions, and the like.
Thank you so much.
Code: