Greetings, I am searching for the right way to map the following model.
@Entity class Container { @Id private Long id;
@?? private Set<Int> memberIDs; }
The goal is that the memberIDs are actually other primary key IDs in the database but I don't want to actually link the models of these two particular models, the Container and the Member. The reasons for this are varied but the short version is I have to decide what to store inside the container and I don't want each of the members to be embedded in the object. These objects will be rendered to JSON and there is a decision to make about embedding.
I would like the above scenario to map to a join table so that those using SQL can still see the correct data. The join table would look like any other join table in the database in that it would have the ids and the foreign keys to the actual table containing the member objects.
Is there any way I can do this easily in hibernate? What mapping parameters would i need to put on the entity to have this map and store correctly.
|