I want to have a single consistent cascade policy right through my
application (or at least as a default that I can override only when needed).

The standard enum allows for either specific operations, or ALL.

So I through OK, lets declare a global variable as an array of CascadeType
enums:-

CascadeType[]defaultCascade = {CascadeType.PERSIST,
     CascadeType.MERGE,CascadeType.REFRESH};

and reference it in the annotations:-

@ManyToOne(cascade=defaultCascade)

but of course the annotation is a compile time thing, and I don't think
that it can reach defaultCascade (even if it is final and static).

Anyone got any ideas as to how to do this?

David

Reply via email to