Best way to run a polymorphic query with table-per-hierarchy = true

View: New views
1 Messages — Rating Filter:   Alert me  

Best way to run a polymorphic query with table-per-hierarchy = true

by baha007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm wondering what would be the best way to retrieve subclasses of an abstract parent class with a table-per-hierarchy=true mapping like the following example:
abstract SportsCar {
    String model
...
}
class Ferrari extends SportsCar {...}
class Lamborghini extends SportsCar {...}
class Porsche extends SportsCar {...}

and how would loading all cars like the following :
SportsCar.list()
or
SportsCar.findAllByModel('xyz')

could be done as easily as a table-per-hierarchy=false mapping?

Thanks for any suggestions,


Baha