cascade="delete-orphan,all" is ignored

Description

In HbmBinder.java, the following code has a bug in which it will ignore the "delete-orphan" value if it appears at position 0:

private static void validateCascade(Element node, String path) {
String cascade = node.attributeValue("cascade");
if ( cascade!=null && cascade.indexOf("delete-orphan")>0 ) {
throw new MappingException("single-valued associations do not support orphan delete: " + path);
}
}

Instead, it should be:

if ( cascade!=null && cascade.indexOf("delete-orphan")>=0 ) {

As a result, the user will not be warned if "delete-orphan,all" was specified in the cascade attribute, which is meaningless.

Environment

None

Activity

Show:
Steve Ebersole
October 3, 2007, 7:44 AM

3.2/trunk

Rafael Chaves
October 3, 2007, 8:13 PM

Thanks!

Assignee

Steve Ebersole

Reporter

Rafael Chaves

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Trivial
Configure