Hibernate version: 3.2.1.GA
Mapping documents:
Code:
@Entity
@DiscriminatorColumn(name = "ID_TXN_TYPE", discriminatorType = DiscriminatorType.INTEGER)
public abstract class Transaction {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ID_TXN_TYPE", insertable = false, updatable = false)
private Type type;
//...
}
@Entity
@DiscriminatorValue(value = "-1")
public class JUnitTx extends Transaction {
}
Hi!
I'm having a discriminator column which is used to define a many-to-one relation (see Transaction class) in parallel. Now i have some conrete classes (e.g. JUnitTx) with distinct discriminator columns and so far, everything works fine.
Point is, if I want to get the Type, it is null, even after I inserted the entity, it is null. I must flush, evict&load or refresh the entity to have the value available.
Is there anyway to let Hibernate automatically fetch the entity associated with the discriminator column?
Thanks,
Sebastian