Hi,

Note that you can turn on CascadeType.PERSIST across the board (but can't subsequently turn it off) by setting the persistence-unit- defaults/cascade-persist element in orm.xml to true.

-Patrick

On Apr 29, 2008, at 5:30 AM, David Goodenough wrote:

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

--
Patrick Linskey
202 669 5907

Reply via email to