views:

30

answers:

0

I would like to know if it's possible to create a relationship with an entity using hibernate.

In one of my models like:

public Entity associated_model; 
public Long associated_model_id;

I would like to establish a relationship table with multiple kind of objects by storing their entry id and a model id or name.

I'm trying to do that in order to create a ownership relationship between my user model and any other models of my project without creating one foreign key for each model in my user table.