What is an assigned id?
Maybe I am going the wrong way, but I explain what I try to do: I persist an new entity which has a child entity (many-to-one relationship). The entity has a foreign key of the child, but the child is not updated and already exists. The entity class has a field of type child entity.
So I want to set the foreign key easily by
entity.setChild(new ChildEntity(childId))
instead of
ChildEntity c = new ChildEntity();
c.setId(childId);
entity.setChild(c);
3 lines instead of 1!
I don't need to set the other fields of the child entity as it is not persisted.
Thanks