[forge-issues] [JBoss JIRA] (FORGE-397) PersistencePlugin does not mark one side of a OneToOne as 'mappedBy'

Richard Kennard (Commented) (JIRA) jira-events at lists.jboss.org
Tue Dec 6 20:33:41 EST 2011


    [ https://issues.jboss.org/browse/FORGE-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648675#comment-12648675 ] 

Richard Kennard commented on FORGE-397:
---------------------------------------

Note this *almost* works, because org.jboss.forge.spec.javaee.jpa.FieldPlugin.newOneToOneRelationship takes an 'inverseFieldName' parameter, and correctly adds it to the inverse class. It just doesn't seem to do...

annotation.setStringValue("mappedBy", inverseFieldName);

...which the other methods (newManyToManyRelationship etc) do?
                
> PersistencePlugin does not mark one side of a OneToOne as 'mappedBy'
> --------------------------------------------------------------------
>
>                 Key: FORGE-397
>                 URL: https://issues.jboss.org/browse/FORGE-397
>             Project: Forge
>          Issue Type: Enhancement
>            Reporter: Richard Kennard
>
> The PersistencePlugin currently generates OneToOne relationships like this:
> 	@OneToOne
> 	private Profile profile;
> 	public Profile getProfile() {
> 		return this.profile;
> 	}
> 	public void setProfile(final Profile profile) {
> 		this.profile = profile;
> 	}
> ...and...
> 	@OneToOne
> 	private Customer customer;
> 	public Customer getCustomer() {
> 		return this.customer;
> 	}
> 	public void setCustomer(final Customer customer) {
> 		this.customer = customer;
> 	}
> Ideally one side of the relationship should be marked as the 'inverse':
> 	@OneToOne(mappedBy="profile")
> 	private Customer customer;
> 	public Customer getCustomer() {
> 		return this.customer;
> 	}
> 	public void setCustomer(final Customer customer) {
> 		this.customer = customer;
> 	}

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