Annotation Type DefaultNullSavingStrategy


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface DefaultNullSavingStrategy
    Annotates a Dao interface to define a default NullSavingStrategy, that will apply to all methods that don't explicitly declare one.

    For example, given this interface:

     @Dao
     @DefaultNullSavingStrategy(SET_TO_NULL)
     public interface ProductDao {
    
       @Insert
       void insert(Product product);
    
       @Update(nullSavingStrategy = DO_NOT_SET)
       void update(Product product);
     }
     
    • insert(Product) will use SET_TO_NULL (inherited from the DAO's default).
    • update(Product) will use DO_NOT_SET.
    If the DAO interface isn't annotated with DefaultNullSavingStrategy, any method that does not declare its own value defaults to DO_NOT_SET.

    Note that null saving strategies are only relevant for Update, Insert, Query and SetEntity methods.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      NullSavingStrategy value