Lookup tables

Here how to create a Lookup table annotated with JPA to use with the parancoe framework. This is a standard JPA annotated pojo, it means it could be used even out of the parancoe context.

As an example to represent gender of users.


package examples.parancoe.po;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public enum Gender {

    MALE(0L, "MALE"),
    FEMALE(1L, "FEMALE")
    ;

    private Long id;   
    private String description; 

    Gender(Long id, String description) {
        this.id = id;
        this.description = description;
    }
    @Id
    public Long getId() {        
        return id;
    }
    public void setId(Long id) {        
        this.id=id;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }

}

Posted by Enrico Giurin on Wednesday, December 02, 2009