Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

How to prebuild cascade types

David Goodenough

2008-04-29

Replies: Find Java Web Hosting

Author LoginPost Reply
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
©2008 gg3721.com - Jax Systems, LLC, U.S.A.