package com.acme.model.domain.ejf.entity;


import com.acme.structure.BaseEntity;
import com.acme.structure.BaseEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity(name = "Role")
@Table(name = "MAINROLES")
//this is for oracle db @SequenceGenerator(name = "ROLE_SEQ", sequenceName = "ROLE_SEQ", allocationSize = 1)
@EntityListeners( { BaseEntityListener.class })
public class Role extends BaseEntity
{
    private String roleName;
    private String description;

    public Role()
    {
        entityName = "Role";
    }

    public Role(int id, String name)
    {
        entityName = "Role";
        this.id = id;
        this.roleName = name;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO) //, this is for oracle db, generator = "ROLE_SEQ")
    @Column(name = "ID")
    public int getId()
    {
        return id;
    }

    public void setId(int id)
    {
        this.id = id;
    }

    @Column(name = "ROLENAME")
    public String getRoleName()
    {
        return roleName;
    }

    public void setRoleName(String roleName)
    {
        this.roleName = roleName;
    }

    @Column(name = "DESCRIPTION")
    public String getDescription()
    {
        return description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    @Override
    public String toString()
    {
        return getRoleName();
    }

}
