001package com.avaje.ebean.annotation; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Retention; 005import java.lang.annotation.RetentionPolicy; 006import java.lang.annotation.Target; 007 008/** 009 * Specify that the elements of a OneToMany are private owned. 010 * <p> 011 * This means that if they are removed from the List/Set/Map they will be 012 * deleted when their parent object is saved. 013 * </p> 014 * <p> 015 * This could also be described as deleting orphans - in that beans removed from 016 * the List/Set/Map will be deleted automatically when the parent bean is saved. 017 * They are considered 'orphans' when they have been removed from the collection 018 * in that they are no longer associated/linked to their parent bean. 019 * </p> 020 */ 021@Target({ ElementType.FIELD, ElementType.METHOD }) 022@Retention(RetentionPolicy.RUNTIME) 023public @interface PrivateOwned { 024 025 /** 026 * Set this to false if you don't want cascade REMOVE on this relationship. 027 * <p> 028 * That is, by default PrivateOwned implicitly adds a cascade REMOVE to the 029 * relationship and if you don't want that you need to set this to false. 030 * </p> 031 */ 032 boolean cascadeRemove() default true; 033 034}