Hi,
Is there a way for me to get a collection of object from a query? My problem right now is I want to return a list of object from a table called Activity, which have objects extending it with inheritance. I want to be able to cast my result into specific object that is extending it. I could query the entire activity record but there doesn't appear to be a way for me to know if it is a WORK activity or a FUN activity. Is there a way for me to get the DiscriminatorValue since it doesn't have any getter. Reason is I want to return a collection of all the work and fun activity without querying only fun activity. This is only a short example but my code has 8 more different type of activity.
Thank you.
@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "activityType", discriminatorType = DiscriminatorType.STRING) public class Activity
@Entity @DiscriminatorValue("WORK") public class Work extends Activity {
@Entity @DiscriminatorValue("FUN") public class Fun extends Activity {
|