This works fine and all is well.
My issue is that inside of this table there is a column called "type" so the rows inside of this table can actually be one of three types (A, B or C). Right now they all get lumped under ClassA. I'd like to make a Class for each "type" though, is there a way using annotations that I can kind of filter out the results of this table based on the "type" column?
So I'd like to make ClassA, ClassB, and ClassC that all use table "object" but filter based on the column "type". They'll all have the same attributes but each might have different methods associated with them because they each do different things.
I'm working with an existing database/application so I can't change the actual database layout or anything, this is basically a read only type app.
I hope that makes sense.
Ganesh Shirsat wrote:Hi
you can used the discriminator concept of hibernate.. "multiple class for one table"
using discriminator you can specify the object type and accordingly that hibernate will fetch the record for your type
Ganesh, this is what I was looking for, thanks.
I do have an issue though now. I've used some of the examples I've found but they don't seem to be working. The first class will pull all the records from the table despite their "type" and the second class that extends that first class pulls nothing. Below is the code I'm using, do you see anything wrong with it?
I'm doing just a simple Hibernate createCriteria(ObjOne.class).list() to test this if that helps.