Hi,
> I want to customize the CascadeType for a many-to-one relationship. I dont
> want the associated Role to be deleted when one User is deleted. So I did
> the customization as:
> <jaxb:bindings
> node="xsd:complexType[@name='user']//xsd:element[@name='role']">
> <hj:many-to-one>
> <orm:join-column name="ROLEID" nullable="false" />
> <orm:cascade>
> <orm:cascade-persist />
> <orm:cascade-refresh />
> <orm:cascade-merge />
> </orm:cascade>
> </hj:many-to-one>
> </jaxb:bindings>
> But HJ3 generated the following annotation:
> @ManyToOne(targetEntity = Role.class, cascade = {
> CascadeType.MERGE,
> CascadeType.PERSIST,
> CascadeType.REFRESH,
> CascadeType.ALL
> })
> Why CascadeType.ALL is also there? Isn't it a conflict?
Your customization gets "merged" with the "default" customizations
(see ejb\plugin\src\main\resources\org\jvnet\hyperjaxb3\ejb\strategy\customizing\impl\DefaultCustomizations.xml).
Merging is useful so that you don't have to provide all the elements
when you customize.
If you don't want this merging use merged="false", something like:
<hj:many-to-one merged="false" ...>
> I'm thinking to use Annotate plugin to remove this addtional annotation. Is
> this plugin capable to do it?
No, it can't.
Bye,
/lexi