u j [http://community.jboss.org/people/bcn] created the discussion

"Re: How to add constructors with ID in pojo generation?"

To view the discussion, visit: http://community.jboss.org/message/602859#602859

--------------------------------------------------------------
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
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/602859#602859]

Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to