This content has been marked as final.
Show 2 replies
-
1. Re: Hibernate Reverse Engineering JPA orphanRemoval
dgeraskov Jul 1, 2011 2:59 AM (in response to pv)Sure you can do this. Look at Ejb3PropertyGetAnnotation.ftl.
For example ${pojo.generateOneToOneAnnotation(property, cfg)}
This will create @OneToOne annotation. If you use JPA2.0 specification you can alter returned string with orphanRemoval="true" attribute. (By using String#substring and concatenation).
In JPA1.0 you can just add
@org.hibernate.annotations.Cascade( value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
after the generated @OneToOne.
Hope this helps
-
2. Re: Hibernate Reverse Engineering JPA orphanRemoval
pv Jul 1, 2011 3:07 PM (in response to dgeraskov)Is there a way to do this selectively based on a meta attribute?