[forge-issues] [JBoss JIRA] (FORGE-401) PersistencePlugin should not initialize default value for @ManyToOne

Richard Kennard (Updated) (JIRA) jira-events at lists.jboss.org
Tue Dec 6 20:45:40 EST 2011


     [ https://issues.jboss.org/browse/FORGE-401?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Kennard updated FORGE-401:
----------------------------------

    Description: 
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.

  was:
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 = new Employer();

	@ManyToOne
	private Employer employer = new Employer();

The first one is non-controversial. The second is slightly controversial but actually makes things much easier for the UI so please keep it :)

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.


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