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

Max Rydahl Andersen do-not-reply at jboss.com
Tue May 3 20:20:49 EDT 2011


Max Rydahl Andersen [http://community.jboss.org/people/maxandersen] created the discussion

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

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

--------------------------------------------------------------
assigned id is when you do not have autogenerated keys.

entity.setChild(new ChildEntity(childId)) is rather bad since why do you want to have an incomplete objectgraph?

better approach is:

entity.setChild(session.load(ChildEntity.class, childId));

That will do the same thing and wont load the childentity unless you try to access methods on it avoiding incomplete objectgraph.
--------------------------------------------------------------

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

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/20110503/579986e5/attachment.html 


More information about the jboss-user mailing list