Hi all, I am using the brand new EJB3.0 Beta1, but I am having a problem with an issue that did not happen using the Preview5.
I have implemented a
single-table per class strategy (entities that extend a superclass, all mapped to the same table and using a discriminator). I have everything as the documentation tells:
For the superclass:
Code:
@Entity
@Table(name = "message_event")
@Inheritance(strategy = SINGLE_TABLE, discriminatorType = CHAR, discriminatorValue = "-")
@DiscriminatorColumn(name = "event_type")
@SequenceGenerator(name="seq_event", sequenceName="seq_event")
public class Event implements Serializable {
...
}
and, for instance, a subclass:
Code:
@Entity
@Inheritance(discriminatorValue="I")
public class InfoEvent extends Event{
...
}
If I create a query or a criteria looking for all entities 'from PersEvent' I get this exception:
Quote:
org.hibernate.WrongClassException: Object with id: 2 was not of the specified subclass: com.test.PersEvent
The object with id 2 isa InfoEvent (that extends Event), so no exception should be thrown. I did not happend using the Preview 5,
Has anybody else observed this behaviour? Am I missing something?
Regards,
Bruno