org.springframework.roo.addon.entity
Annotation Type RooEntity


@Target(value=TYPE)
@Retention(value=SOURCE)
public @interface RooEntity

Provides services related to JPA.

Using this annotation also triggers RooBeanInfo.

Since:
1.0
Author:
Ben Alex

Optional Element Summary
 String catalog
          Specifies the database catalog name that should be used for the entity.
 String countMethod
           
 String findAllMethod
           
 String findEntriesMethod
           
 String[] finders
           
 String findMethod
           
 String flushMethod
           
 String identifierColumn
          Specifies the column name that should be used for the identifier field.
 String identifierField
          Creates an identifier, unless there is already a JPA @Id field annotation in a superclass (either written in normal Java source or introduced by a superclass that uses the RooEntity annotation.
 Class<? extends Serializable> identifierType
           
 String inheritanceType
          Specifies the JPA inheritance type that should be used for the entity.
 boolean mappedSuperclass
           
 String mergeMethod
           
 String persistenceUnit
           
 String persistMethod
           
 String removeMethod
           
 String schema
          Specifies the database schema name that should be used for the entity.
 String table
          Specifies the table name that should be used for the entity.
 String versionColumn
          Specifies the column name that should be used for the version field.
 String versionField
          Creates an optimistic locking version field, unless there is already a JPA @Version field annotation in a superclass (either written in normal Java source or introduced by a superclass that uses the RooEntity annotation.
 Class<? extends Serializable> versionType
           
 

identifierType

public abstract Class<? extends Serializable> identifierType
Returns:
the class of identifier that should be used (defaults to Long; must be provided)
Default:
java.lang.Long.class

identifierField

public abstract String identifierField
Creates an identifier, unless there is already a JPA @Id field annotation in a superclass (either written in normal Java source or introduced by a superclass that uses the RooEntity annotation.

If you annotate a field with JPA's @Id annotation, it is required that you provide a public accessor for that field.

Returns:
the name of the identifier field to use (defaults to "id"; must be provided)
Default:
"id"

identifierColumn

public abstract String identifierColumn
Specifies the column name that should be used for the identifier field. By default this is generally made identical to the identifierField(), although it will be made unique as required for the particular entity fields present.

Returns:
the name of the identifier column to use (default to ""; in this case it is automatic)
Default:
""

versionField

public abstract String versionField
Creates an optimistic locking version field, unless there is already a JPA @Version field annotation in a superclass (either written in normal Java source or introduced by a superclass that uses the RooEntity annotation. The produced field will be of the type specified by versionType().

If you annotate a field with JPA's @Version annotation, it is required that you provide a public accessor for that field.

Returns:
the name of the version field to use (defaults to "version"; must be provided)
Default:
"version"

versionColumn

public abstract String versionColumn
Specifies the column name that should be used for the version field. By default this is generally made identical to the versionField(), although it will be made unique as required for the particular entity fields present.

Returns:
the name of the version column to use (default to "version"; in this case it is automatic)
Default:
"version"

versionType

public abstract Class<? extends Serializable> versionType
Returns:
the class of version that should be used (defaults to Integer; must be provided)
Default:
java.lang.Integer.class

persistMethod

public abstract String persistMethod
Returns:
the name of the "persist" method to generate (defaults to "persist"; mandatory)
Default:
"persist"

flushMethod

public abstract String flushMethod
Returns:
the name of the "flush" method to generate (defaults to "flush"; mandatory)
Default:
"flush"

mergeMethod

public abstract String mergeMethod
Returns:
the name of the "merge" method to generate (defaults to "merge"; mandatory)
Default:
"merge"

removeMethod

public abstract String removeMethod
Returns:
the name of the "remove" method to generate (defaults to "remove"; mandatory)
Default:
"remove"

countMethod

public abstract String countMethod
Returns:
the prefix of the "count" method to generate (defaults to "count", with the plural of the entity appended after the specified method name; mandatory)
Default:
"count"

findAllMethod

public abstract String findAllMethod
Returns:
the prefix of the "findAll" method to generate (defaults to "findAll", with the plural of the entity appended after the specified method name; if empty, does not create a "find all" method)
Default:
"findAll"

findMethod

public abstract String findMethod
Returns:
the prefix of the "find" (by identifier) method to generate (defaults to "find", with the simple name of the entity appended after the specified method name; mandatory)
Default:
"find"

findEntriesMethod

public abstract String findEntriesMethod
Returns:
the prefix of the "find[Name]Entries" method to generate (defaults to "find", with the simple name of the entity appended after the specified method name, followed by "Entries"; mandatory)
Default:
"find"

finders

public abstract String[] finders
Returns:
an array of strings, with each string being the full name of a method that should be created as a "dynamic finder" by an additional add-on that can provide implementations of such methods (optional)
Default:
""

persistenceUnit

public abstract String persistenceUnit
Returns:
the name of the persistence unit defined in the persistence.xml file (optional)
Default:
""

mappedSuperclass

public abstract boolean mappedSuperclass
Returns:
whether to generated a @MappedSuperclass type annotation instead of @Entity (defaults to false).
Default:
false

table

public abstract String table
Specifies the table name that should be used for the entity.

Returns:
the name of the table to use (default to "")
Default:
""

schema

public abstract String schema
Specifies the database schema name that should be used for the entity.

Returns:
the name of the schema to use (default to "")
Default:
""

catalog

public abstract String catalog
Specifies the database catalog name that should be used for the entity.

Returns:
the name of the catalog to use (default to "")
Default:
""

inheritanceType

public abstract String inheritanceType
Specifies the JPA inheritance type that should be used for the entity.

Returns:
the inheritance type to use (default to "")
Default:
""


Copyright © 2011. All Rights Reserved.