I have 3 tables:
Project.id
Project.name
Cost.id
Cost.price
CostLink.cost_id
CostLink.table_name
CostLink.table_id
my query:
SELECT *
FROM Project p
JOIN CostLink l on p.id = l.table_id and l.table_name = 'PROJECT'
JOIN Cost c on l.cost_id = c.id
My question is , how do i create my Cost and Project entities in hibernate to use this polymorphic link table?
I'm using dropwizard with hibernate. Much thanks in advance!