Skip to content

Instantly share code, notes, and snippets.



Created Feb 27, 2015
What would you like to do?
【メモ】Hibernateでinsert時にprimary keyでauto incrementを指定している時 ref:
ERROR [2015-02-27 11:01:38,781] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: ef46ad41b77903a3
! com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hoge.hibernate_sequence' doesn't exist
! at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_20]
package hoge.bean;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.joda.time.DateTime;
public class HogeTable {
@GeneratedValue(strategy=GenerationType.IDENTITY) // これをつけて解決
private Integer id;
private DateTime created;
private DateTime modified;
public Integer getId() {
return id;
public void setId(Integer id) { = id;
public DateTime getCreated() {
return created;
public void setCreated(DateTime created) {
this.created = created;
public DateTime getModified() {
return modified;
public void setModified(DateTime modified) {
this.modified = modified;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.