Annotation Interface UnrelatedTo


@Retention(RUNTIME) @Target(TYPE) public @interface UnrelatedTo
This annotation breaks a relationship that exists based on naming conventions. Value is an array of classes this model should not be related to, despite conventions discovered in the schema.

This annotation can be placed on just one side of a relationship for brevity.

Why would you need this annotation? If you use caching, it will invalidate caches of related models in cases where a destructive operation is executed (DELETE, INSERT, UPDATE). If you do not want your table to be flushed again and again, you can disconnect the relationship by using this annotation. You can still manage the relationship manually using the foreign key in a child table, but methods like parent.add(child) or child.parent(Parent.class) and others will not work ... unless you override them.

Author:
Igor Polevoy
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends Model>[]
     
  • Element Details