org.genericdao
Annotation Type PrimaryKey


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

The annotation used declare the primary key properties of a Java Bean.

The names of the primary key properties are passed as a String. You must use Java capitalization conventions.

Here is a simple example:

     @PrimaryKey("id")
     public class Customer {
         private int    id;
         private String firstName;
         private String lastName;

         public int     getId()        { return id;        }
         public String  getFirstName() { return firstName; }
         public String  getLastName()  { return lastName;  }

         public void setId(int i)           { id = i; }
         public void setFirstName(String s) { firstName = s; }
         public void setLastName(String s)  { lastName = s;  }
     }
 

Properties of composite keys must be listed in order, comma separated:

     @PrimaryKey("lastName,firstName")
     public class AddressBookEntry {
         private String firstName;
         private String lastName;
         ...
     }
 


Required Element Summary
 String value
           
 

Element Detail

value

public abstract String value


Copyright © 2012 Jeffrey L. Eppinger. All rights reserved. Permission granted for educational use only.