Hi,
I have 3 Tables (I will give examples not exact tables but same structure and logic)
Code:
Cars :
ID ( Car ID)
Name
Planes :
ID ( Plane ID)
Name
Processes :
ID ( Process ID )
Type
VehicleID
Sample Processes Table DataCode:
ID Type VehicleID
--- ------- ------------
1 1 1
2 1 2
3 2 1
3 2 2
When type is
1, This is
Car and means that
VehicleID maps to
Cars Table,
When type is
2, This is
Plane and means that
VehicleID maps to
Planes Table.
And So On 3, 4, 5, 6 .. for Additional tables.
How can i map something like that? I can not merge these tables, they all must be separated..
I used to handle this by writing native SQL with some functions, however with JPA i could not figure it out..
Thanks again
Regards.