Specify CascadeType for jpa-relations



how can i specify the CascadeType for my relations?

I’ve found the “ORM Association End Detail” settings and changed to “Cascade with delete orphan”, this should generate the JPA1 cascade=CascadeType.ALL attribute on the one2many and the Hibernate annotation:
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)

but nothing happend on next java-roundtrip.

Then i’ve tried to change the code after the first java roundtrip from:

private Collection employments;


@OneToMany(cascade = CascadeType.ALL)
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
private Collection employments;

But both (the additional attribute on OneToMany and the @Cascade annotation) are removed after next java-round-trip.

Furthermore I’ve found no way to specify java-annotations on relations (like the java-annotation tab on classes and members).

Another Question:
we are using java-enumeration string in many cases in our ORMs and saving them in database as String (@Enumerated(EnumType.STRING)).
I’ve put the annotation on each enum-attribute of my ORM-Classes after choosing the enum-class as type.
But the generated ERD generates an integer-column for this enum-type. If i change this to a String-column and sync back to class model i lost the enum-type (replaced with string). How can i avoid this?

Is there an overview of all java-annotations which can be generated from java-round-trip and the respective dialog where i can setup this?
Because it looks like the most ORM-specific dialogs are only for the ORM-Code-Generator and not for java-round-trip…


I have this problem as well. I want theannotation for my association to @OneToOne(cascade=CascadeType.ALL) but I cannot see how to get VP to output this annotation. Setting it in my code does not persist when running java round-trip.

Is there a solution for this??


Very nice written iltacre. Concise and easy to following.Only one question, quote The “join” fetching strategy will disabled the lazy loading of all it’s related collections Let’s say only the following is executed: Stock stock = Stock session.get Stock.class, 114 ;I would suspect, the query output should only be: select …from mkyong.stock where stock0_.STOCK_ID=?NOT select … from mkyong.stock stock0_ left outer join mkyong.stock_daily_record stockdaily1_ on stock0_.STOCK_ID=stockdaily1_.STOCK_ID where stock0_.STOCK_ID=?Or I missed anything?Thanks -Chris