package com.github.piotr_rusin.yule.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.Table;

/**
 * A class representing blog posts.
 * 
 * @author Piotr Rusin <piotr.rusin88@gmail.com>
 */
@Entity
@Table(name="posts")
public class Post {
	@Id
	@Column(name="id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	private String title;

	private String slug;

	private String content;

	@Column(name="creation_date")
	private Date creationDate;

	public int getId() {
		return id;
	}

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

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSlug() {
		return slug;
	}

	public void setSlug(String slug) {
		this.slug = slug;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	@PrePersist
	protected void resetCreationDate() {
		creationDate = new Date();
	}

}

@@ -267,50 +267,65 @@
 nce.
-PrePersist;%0Aimport javax.persistence.Table
+Table;%0Aimport org.hibernate.annotations.CreationTimestamp
 ;%0A%0A/
@@ -667,16 +667,36 @@
 _date%22)%0A
+%09@CreationTimestamp%0A
 %09private
@@ -1210,90 +1210,7 @@
 %09%7D%0A%0A
-%09@PrePersist%0A%09protected void resetCreationDate() %7B%0A%09%09creationDate = new Date();%0A%09%7D%0A
 %0A%7D%0A

Replace a way for setting post creation date