Hibernate: 3.2.1.ga / Annotations: 3.2.1.GA / EntityManager: 3.2.1.GA
I'm using a JOINED inheritence strategy with a discriminator column. The superclass also has a field mapped to the discriminator column. When I try to persist the subclass, I get a PropertyValueException:
Code:
not-null property references a null or transient value: edu.jhuapl.ermp.model.entities.Task.aplEntityType
on the field mapped to the discriminator column. AFAICT, this means the field is not getting set with the discriminator value as it should. The classes are:
Code:
@Entity
@Table(name="APL_ENTITY", schema="ERMPMGR")
@Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="apl_entity_type_code", discriminatorType=DiscriminatorType.STRING)
public abstract class APLEntity {
@Column(name="APL_ENTITY_TYPE_CODE", nullable=false)
private APLEntityType aplEntityType;
@Id
@Column(name="APL_ENTITY_SEQ_NUM", nullable=false)
private Long id;
...
@Entity
@Table(name="subtask", schema="fpbadmin")
@DiscriminatorValue("TASK")
public class Task extends APLEntity {
@Column(name="SUBTASK_ID")
private String taskID;
...
I've also tried it with a
Code:
@PrimaryKeyJoinColumn(name="apl_entity_seq_num")
on the Task class (which shouldn't be required since both tables use same column name--should be applied by default), but still the same problem.
I've looked over the hibernate unit tests for this type of mapping and aside from the mapping to the discriminator column, they seem similar. Any ideas anyone?
TIA, Clark