net.sourceforge.pbeans.annotations
Annotation Type PersistentClass


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface PersistentClass

Annotation that marks a class as persistent.

The following is an example of a class that uses this annotation.

 @PersistentClass(
   table="User",
   autoIncrement=true,
   idField="UserID",
   indexes=@PropertyIndex(unique=true,propertyNames={"userName"})
 }
 public class User {
   public String getUserName() {
   ...
   }
   
   public void setUserName(String userName) {
   ...
   }
 }
 


Optional Element Summary
 boolean autoIncrement
          When set to true, requests the ID field to be auto-increment.
 boolean deleteFields
          In automatic schema evolution mode, this value indicates whether fields no longer mapped from bean properties should be removed from the underlying table.
 java.lang.String idField
          Requests a name for the ID field.
 PropertyIndex[] indexes
          An array of property indexes that will be translated into database indexes.
 java.lang.String table
          The requested table name.
 boolean userManaged
          When this value is true, the annotated table will not be automatically created or altered.
 

table

public abstract java.lang.String table
The requested table name. If one is not provided, pBeans will map a unique name based on the fully-qualified class name.

Default:
""

indexes

public abstract PropertyIndex[] indexes
An array of property indexes that will be translated into database indexes. Indexes allow records to be looked up more quickly. Unique indexes ensure duplicate records are not allowed.

Default:
{}

userManaged

public abstract boolean userManaged
When this value is true, the annotated table will not be automatically created or altered. The user is expected to keep the database up to date by other means. However, warnings will be logged if tables are not structured as expected.

Default:
false

autoIncrement

public abstract boolean autoIncrement
When set to true, requests the ID field to be auto-increment. If auto-increment is not supported, or if this value is false, then random IDs will be used.

Default:
false

deleteFields

public abstract boolean deleteFields
In automatic schema evolution mode, this value indicates whether fields no longer mapped from bean properties should be removed from the underlying table. By default existing fields are not removed.

Default:
false

idField

public abstract java.lang.String idField
Requests a name for the ID field. If this value is not provided, pBeans will use a special field name.

Default:
"JP__OBJECTID"