JBoss Community

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

created by Max Rydahl Andersen in JBoss Tools - View the full discussion

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

Start a new discussion in JBoss Tools at Community