/java/

Java Persistence ColumnDefinition

2013-02-13 22:35:41

package com.louis.core.model;

@Entity
@Table(name = "document")
@NamedQueries({
    @NamedQuery(name = "Document.findAll", query = "SELECT p FROM Document p")
})
public class Document implements Serializable{

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false, updatable = false)
    private Long id;

    @Column(name = "name", columnDefinition="varchar(50)")
    private String name;

    @Column(name = "description", columnDefinition="varchar(255)")
    private String description;

    @Column(name = "slug", columnDefinition="varchar(100)")
    private String slug;

    @Column(name = "status", columnDefinition="tinyint(1)")
    private int status;

    @Column(name = "content", columnDefinition="text")
    private String content;

    @Column(name = "created_at", columnDefinition="date")
    private Date createdAt;

    @Column(name = "updated_at", columnDefinition="datetime")
    private Date updatedAt;


    public Document() {

    }
}