Skip to content

Invalid combinations

Invalid combinations

These combinations should fail when the application starts.

Missing field

@UponInserting(
    entity = Person.class,
    valueType = ValueType.BOOLEAN,
    value = "true"
)
public void invalid(Person person) {
}

Missing value

@UponInserting(
    entity = Person.class,
    field = "active",
    valueType = ValueType.BOOLEAN
)
public void invalid(Person person) {
}

Missing valueType

@UponUpdating(
    entity = Person.class,
    field = "name",
    value = "Anthony"
)
public void invalid(Person person) {
}

Use the complete declarative filter instead:

@UponUpdating(
    entity = Person.class,
    field = "name",
    valueType = ValueType.STRING,
    value = "Anthony"
)
public void valid(Person person) {
}

Same operation declared twice

@UponUpdating(entity = Person.class)
@TentacolousListener(entity = Person.class, action = ActionListener.UPDATE)
public void invalid(Person person) {
}

A method can listen to different operations, but not to the same operation twice.

Method with more than one parameter

@UponInserting(entity = Person.class)
public void invalid(Person person, String other) {
}

Incompatible parameter

@UponInserting(entity = Person.class)
public void invalid(String person) {
}