[forge-issues] [JBoss JIRA] (FORGE-398) PersistencePlugin does not generate Cascade

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


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

Richard Kennard updated FORGE-398:
----------------------------------

    Description: 
This is one of those 'we could do it a different way, but it would make the generated code cleaner if...' requests :)

At present the PersistencePlugin generates:

	@OneToOne
	private Profile profile;

	public Profile getProfile() {
		return this.profile;
	}

	public void setProfile(final Profile profile) {
		this.profile = profile;
	}

I would instead like it to generate:

	@OneToOne(cascade = CascadeType.ALL)
	private Profile profile;

	public Profile getProfile() {
		return this.profile;
	}

	public void setProfile(final Profile profile) {
		this.profile = profile;
	}


  was:
This is one of those 'we could do it a different way, but it would make the generated code cleaner if...' requests :)

At present the PersistencePlugin generates:

	private @OneToMany(mappedBy = "customer")
	Set<SubmittedOrder> orders = new HashSet<SubmittedOrder>();

	public Set getOrders() {
		return this.orders;
	}

	public void setOrders(final Set orders) {
		this.orders = orders;
	}

	@OneToOne
	private Profile profile;

	public Profile getProfile() {
		return this.profile;
	}

	public void setProfile(final Profile profile) {
		this.profile = profile;
	}

I would instead like it to generate:

	private @OneToMany(cascade = CascadeType.ALL)
	Set<SubmittedOrder> orders = new HashSet<SubmittedOrder>();

	public Set getOrders() {
		return this.orders;
	}

	public void setOrders(final Set orders) {
		this.orders = orders;
	}
	
	@OneToOne(cascade = CascadeType.ALL)
	private Profile profile;
	public Profile getProfile() {
		return this.profile;
	}

	public void setProfile(final Profile profile) {
		this.profile = profile;
	}

So I am asking for:

1. Add CascadeType.ALL to @OneToMany and @OneToOne
2. Remove the 'mappedBy' from @OneToMany. I think this is a mistake, because it is saying this is an inverse relationship? I don't think it should be considered inverse. If 'mappedBy' is there, Cascade will have no effect



    
> PersistencePlugin does not generate Cascade
> -------------------------------------------
>
>                 Key: FORGE-398
>                 URL: https://issues.jboss.org/browse/FORGE-398
>             Project: Forge
>          Issue Type: Feature Request
>            Reporter: Richard Kennard
>
> This is one of those 'we could do it a different way, but it would make the generated code cleaner if...' requests :)
> At present the PersistencePlugin generates:
> 	@OneToOne
> 	private Profile profile;
> 	public Profile getProfile() {
> 		return this.profile;
> 	}
> 	public void setProfile(final Profile profile) {
> 		this.profile = profile;
> 	}
> I would instead like it to generate:
> 	@OneToOne(cascade = CascadeType.ALL)
> 	private Profile profile;
> 	public Profile getProfile() {
> 		return this.profile;
> 	}
> 	public void setProfile(final Profile profile) {
> 		this.profile = profile;
> 	}

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