Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Specifying CASCADE-REMOVE in project.xml

Is your objection to annotations, or to JPA metadata in general?

If you are are looking for an xml-based way of specifying your metadata, JPA allows you to fully specify the metadata in orm.xml files. You can use the Eclipse Dali project for tooling. orm.xml provides equivalent functionality to what is available in annotations.

If you would like to keep using project.xml, your best bet is to modify your mappings through API in an event. I suggest using the preLogin event to modify your descriptors. You can call setCascadeRemove(true) on each ForeignReferenceMapping you would like cascade remove to operate on.

-Tom

rmmora159 wrote:
I need a way to specify a CASCADE-REMOVE setting on a one-to-many
relationship in the project.xml of my eclipselink app.  Currently a remove()
on the parent entity throws an SQL exception because of the foreign key
constraint.  I know this is easily solved using annotations,  but I DO NOT
use annotations nor will I use them because they are a waste of time.  It is
much more efficient to use a single project.xml that describes everything. Furthermore, my application generates its own database tables and entities,
so I need to keep everything as centralized and hands-free as possible. I
use the eclipse Workbench (I know, I shouldn't) to generate all the
necessary components, but that GUI does not seem to have an option to set
cascading type for relationships.  I know I'll probably have to manually add
the CASCADE setting to the project.xml, but I cannot figure out the xsd
specifications to correctly insert it into the xml. I could also take care
of the problem in java before calling the remove() method of the
EntityManager, if someone knows how to do so.


Back to the top