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 * Annotate an entity bean with @View to indicates the bean is based on a view. 010 * <p> 011 * As such typically the view is defined in <code>extra-ddl.xml</code> using 012 * <code>create or replace view ...</code>. 013 * </p> 014 * <p> 015 * When using extra-ddl.xml Ebean will run the resulting DDL script after the 016 * <code>create-all</code> DDL (which is typically used during development) and for 017 * DB Migration will copy the scripts as <code>repeatable migration scripts</code> that 018 * will be run by FlywayDb (or Ebean's own migration runner) when their MD5 hash changes. 019 * </p> 020 */ 021@Retention(RetentionPolicy.RUNTIME) 022@Target(ElementType.TYPE) 023public @interface View { 024 025 /** 026 * The name of the view this entity bean is based on. 027 */ 028 String name(); 029 030 /** 031 * Tables this view is dependent on. 032 * <p> 033 * This is used with l2 caching to invalidate the query cache. Changes to these 034 * tables invalidate the query cache for the entity based on this view. 035 * </p> 036 */ 037 String[] dependentTables() default {}; 038}