[forge-issues] [JBoss JIRA] (FORGE-401) PersistencePlugin should not initialize default value for @ManyToOne
Richard Kennard (Commented) (JIRA)
jira-events at lists.jboss.org
Fri Dec 16 01:07:09 EST 2011
[ https://issues.jboss.org/browse/FORGE-401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651468#comment-12651468 ]
Richard Kennard commented on FORGE-401:
---------------------------------------
Okay, I've tested this. If you can give me:
@OneToOne
private Profile profile;
public void newProfile() {
this.profile = new Profile();
// Bonus points for hooking up any inverse relationship, like:
// this.profile.setCustomer(this);
}
public Profile getProfile() {
return this.profile;
}
public void setProfile(final Profile profile) {
this.profile = profile;
}
That'll do it.
> PersistencePlugin should not initialize default value for @ManyToOne
> --------------------------------------------------------------------
>
> Key: FORGE-401
> URL: https://issues.jboss.org/browse/FORGE-401
> Project: Forge
> Issue Type: Bug
> Reporter: Richard Kennard
> Assignee: Lincoln Baxter III
> Fix For: 1.0.0.Beta4
>
>
> At present the PersistencePlugin generates the following default values in its entity beans:
> @OneToMany
> private Set<Grocery> groceries = new HashSet<Grocery>();
> @OneToOne
> private Employer employer;
> @ManyToOne
> private Employer employer = new Employer();
> The first one is non-controversial. The second one I would like to be initialized (please please?) as it makes things much easier for the UI. But I understand if you are against that.
> But the final one I definitely think should be removed. We should just leave @ManyToOne relationships as 'null' by default. It doesn't make sense to pre-initialize them, even for new entities, because they are meant to point to *existing* entities.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the forge-issues
mailing list