[jboss-user] [JBoss Tools] - Re: How to add constructors with ID in pojo generation?

u j do-not-reply at jboss.com
Sat Apr 30 13:24:39 EDT 2011


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]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110430/bfe979d6/attachment.html 


More information about the jboss-user mailing list