actually thinking of foreign key would be data centric and I am thinking from componentisation point of view. In actual all the refrential contraints are being managed in database itself, and if I want to fetch entities from reverse direction, I can do it in database and if I know the instance of service I can also configure the correct target entity. Comment is just an example but in real life, cheese is just cheese be it on garlic bread or pizza.
And if we talk about
EJB concepts where remoting is possible, lets say CommentsBean is on different server and I am putting comment on my UserBean so I need not to maintain any reference to entity in my User entity and viceversa.
I don't want to design that if I fetch one Entity all the data of my database comes with it. Like if I fetch one user, all the comments are linked with it in entity and all the other work and entities which are associated with that user and then any shared entity where user A worked and user B too, B is also linked through that shared entity path. I mean a user is a user only.
So its like, I want to create one component which can store data in different tables based on configuration. I think it was possible with normal old EJB concepts.