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 * Add an Literal to add to the where clause when a many property (List, Set or 010 * Map) is loaded or refreshed. 011 * 012 * <pre>{@code 013 * 014 * // on a OneToMany property... 015 * 016 * @OneToMany 017 * @Where(clause = "deleted='y'") 018 * List<Topic> topics; 019 * 020 * }</pre> 021 * 022 * <p> 023 * Note that you can include "${ta}" as a place holder for the table alias if 024 * you need to include the table alias in the clause. 025 * </p> 026 * 027 * <pre>{@code 028 * // ... including the ${ta} table alias placeholder... 029 * 030 * @OneToMany 031 * @Where(clause = "${ta}.deleted='y'") 032 * List<Topic> topics; 033 * 034 * }</pre> 035 * 036 * <p> 037 * This will be added to the where clause when lazy loading the OneToMany 038 * property or when there is a join to that OneToMany property. 039 * </p> 040 */ 041@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE }) 042@Retention(RetentionPolicy.RUNTIME) 043public @interface Where { 044 045 /** 046 * The clause added to the lazy load query. 047 * <p> 048 * Note that you can include "${ta}" as a place holder for the table alias if 049 * you need to include the table alias in the clause. 050 * </p> 051 */ 052 String clause(); 053 054}