001    package net.sf.persism.annotations;
002    
003    /**
004     * Created by IntelliJ IDEA.
005     * User: DHoward
006     * Date: 9/8/11
007     * Time: 6:18 AM
008     */
009    
010    import java.lang.annotation.ElementType;
011    import java.lang.annotation.Retention;
012    import java.lang.annotation.RetentionPolicy;
013    import java.lang.annotation.Target;
014    
015    /**
016     * Optional annotation defining a column mapping for a property on the class. This annotation can appear on the class field, getter or setter.
017     */
018    @Retention(RetentionPolicy.RUNTIME)
019    @Target({ElementType.METHOD, ElementType.FIELD})
020    public @interface Column {
021    
022        /**
023         * Name of the column mapped to the property. Used when the property cannot be auto-mapped to a table column.
024         * <p>
025         * It's only required if Persism cannot discover the column/property mapping on its own.
026         */
027        String value() default "";
028    
029        /**
030         * Indicates if the column is generated in the database - like an auto increment field.
031         * This will tell Persism to exclude this column in
032         * insert/update statements and to update the object with this value after an insert.
033         * <p>
034         * It's only required if Persism cannot detect this column attribute on its own.
035         */
036        boolean generated() default false;
037    
038        /**
039         * Indicates that this column is a primary key.
040         * <p>
041         * It's only required if Persism cannot detect this column attribute on its own.
042         */
043        boolean primary() default false;
044    
045        /**
046         * Indicates that this column has a default value in the database. This tells Persism that if the data object
047         * did not specify a value then Persism will update the data object with the default after an insert.
048         * <p>
049         * It's only required if Persism cannot detect this column attribute on its own.
050         */
051        boolean hasDefault() default false;
052    
053    }