package me.wbprime.springdbusecase.jpa.java.models;


import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

/**
 * Class: Ping
 * Date: 2016/04/19 10:11
 *
 * @author Elvis Wang [bo.wang35@renren-inc.com]
 */
@Entity
@Table(name = "pings")
public class Ping {
    @Id
    @GeneratedValue(generator = "increment")
    @GenericGenerator(name="increment", strategy = "increment")
    private Integer id;

    @Column(name = "title", nullable = false)
    private String title;

    @Column(name = "description", nullable = false)
    private String description;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    @Generated(value = GenerationTime.INSERT)
    private Date createTime;

    public final Integer getId() {
        return id;
    }

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

    public final String getTitle() {
        return title;
    }

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

    public final String getDescription() {
        return description;
    }

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

    public final Date getCreateTime() {
        return createTime;
    }

    public final void setCreateTime(final Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Ping{");
        sb.append("id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append(", description='").append(description).append('\'');
        sb.append(", createTime=").append(createTime);
        sb.append('}');
        return sb.toString();
    }
}

@@ -51,153 +51,8 @@
 ;%0A%0A%0A
-import org.hibernate.annotations.Generated;%0Aimport org.hibernate.annotations.GenerationTime;%0Aimport org.hibernate.annotations.GenericGenerator;%0A%0A
 impo
@@ -80,16 +80,16 @@
 Column;%0A
+
 import j
@@ -154,16 +154,57 @@
 dValue;%0A
+import javax.persistence.GenerationType;%0A
 import j
@@ -538,95 +538,42 @@
 lue(
-generator = %22increment%22)%0A    @GenericGenerator(name=%22increment%22, strategy = %22increment%22
+strategy = GenerationType.IDENTITY
 )%0A  
@@ -827,54 +827,47 @@
 ime%22
-)%0A    @Generated(value = GenerationTime.INSERT
+, insertable = false, updatable = false
 )%0A  

Change generated type to IDENTITY instead of AUTO