Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring, MySQL and Hibernate returning Out of range value adjusted for column 'row_id'
    primarykey
    data
    text
    <p>I am using Spring, MySQL and Hibernate returning Out of range value adjusted for column 'row_id' and I am trying to insert a row into my database but I am getting the following error:</p> <pre><code>Hibernate: insert into school_visit (borough, comments, date_of_visit, district, follow_up_action, meeting_schedule, met_with, nt_user, reaction_of_chapter, region, school, time_of_visit, time_stamp, topics_members, topics_speaker, type_of_visit, visitor_fname, visitor_id, visitor_lname) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2012-09-05 15:13:41,692 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 22001 2012-09-05 15:13:41,692 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Data truncation: Out of range value adjusted for column 'row_id' at row 1 </code></pre> <p>Below is the model I am using and you can see that the row_id is set to @GeneratedValue so why am I getting this error. </p> <p>Below is my model:</p> <pre><code>import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty; @Entity @Table(name = "school_visit") public class VisitModel { public Long getRow_id() { return row_id; } public void setRow_id(Long row_id) { this.row_id = row_id; } public String getVisitor_fname() { return visitor_fname; } public void setVisitor_fname(String visitor_fname) { this.visitor_fname = visitor_fname; } public String getVisitor_lname() { return visitor_lname; } public void setVisitor_lname(String visitor_lname) { this.visitor_lname = visitor_lname; } public String getVisitor_id() { return visitor_id; } public void setVisitor_id(String visitor_id) { this.visitor_id = visitor_id; } public String getType_of_visit() { return type_of_visit ; } public void setType_of_visit(String type_of_visit) { this.type_of_visit = type_of_visit; } public String getDate_of_visit() { return date_of_visit; } public void setDate_of_visit(String date_of_visit) { this.date_of_visit = date_of_visit; } public String getBorough() { return borough; } public void setBorough(String borough) { this.borough = borough; } public String getSchool() { return school; } public void setSchool(String school) { this.school = school; } public String getDistrict() { return district; } public void setDistrict(String district) { this.district = district; } public String getMet_with() { return met_with; } public void setMet_with(String met_with) { this.met_with = met_with; } public String getTime_of_visit() { return time_of_visit; } public void setTime_of_visit(String time_of_visit) { this.time_of_visit = time_of_visit; } public String getReaction_of_chapter() { return reaction_of_chapter; } public void setReaction_of_chapter(String reaction_of_chapter) { this.reaction_of_chapter = reaction_of_chapter; } public String getFollow_up_action() { return follow_up_action; } public void setFollow_up_action(String follow_up_action) { this.follow_up_action = follow_up_action; } public String getMeeting_schedule() { return meeting_schedule; } public void setMeeting_schedule(String meeting_schedule) { this.meeting_schedule = meeting_schedule; } public String getComments() { return comments; } public void setComments(String comments) { this.comments = comments; } public String getTopics_speaker() { return topics_speaker; } public void setTopics_speaker(String topics_speaker) { this.topics_speaker = topics_speaker; } public String getTopics_members() { return topics_members; } public void setTopics_members(String topics_members) { this.topics_members = topics_members; } public Date getTime_stamp() { return time_stamp; } public void setTime_stamp(Date time_stamp) { this.time_stamp = time_stamp; } public String getNt_user() { return nt_user; } public void setNt_user(String nt_user) { this.nt_user = nt_user; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } @Id @GeneratedValue @Column(name = "row_id") private Long row_id; @Size(max = 50) @Column(name = "visitor_fname", nullable = false) private String visitor_fname; @Size(max = 50) @Column(name = "visitor_lname", nullable = false) private String visitor_lname; @Size(max = 5) @Column(name = "visitor_id", nullable = false) private String visitor_id; @Size(max = 25) @Column(name = "type_of_visit", nullable = false) private String type_of_visit; @Size(max = 45) @Column(name = "date_of_visit", nullable = false) private String date_of_visit; @Size(max = 1) @Column(name = "borough", nullable = false) private String borough; @Size(max = 3) @Column(name = "school", nullable = false) private String school; @Size(max = 3) @Column(name = "district", nullable = false) private String district; @Size(max = 200) @Column(name = "met_with", nullable = false) private String met_with; @Size(max = 50) @Column(name = "time_of_visit", nullable = false) private String time_of_visit; @Size(max = 50) @Column(name = "reaction_of_chapter", nullable = false) private String reaction_of_chapter; @Size(max = 50) @Column(name = "follow_up_action", nullable = false) private String follow_up_action; @Size(max = 30) @Column(name = "meeting_schedule", nullable = false) private String meeting_schedule; @Size(max = 2450) @Column(name = "comments", nullable = false) private String comments; @Size(max = 2450) @Column(name = "topics_speaker", nullable = false) private String topics_speaker; @Size(max = 2450) @Column(name = "topics_members", nullable = false) private String topics_members; @Column(name = "time_stamp", nullable = false) private Date time_stamp; @Size(max = 50) @Column(name = "nt_user", nullable = false) private String nt_user; @Size(max = 3) @Column(name = "region", nullable = false) private String region; @Override public String toString() { return "VisitModel [row_id=" + row_id + ", visitor_fname=" + visitor_fname + ", visitor_lname=" + visitor_lname + ", visitor_id=" + visitor_id + ", type_of_visit=" + type_of_visit + ", date_of_visit=" + date_of_visit + ", borough=" + borough + ", school=" + school + ", district=" + district + ", met_with=" + met_with + ", time_of_visit=" + time_of_visit + ", reaction_of_chapter=" + reaction_of_chapter + ", follow_up_action=" + follow_up_action + ", meeting_schedule=" + meeting_schedule + ", comments=" + comments + ", topics_speaker=" + topics_speaker + ", topics_members=" + topics_members + ", time_stamp=" + time_stamp + ", nt_user=" + nt_user + ", region=" + region + ", getRow_id()=" + getRow_id() + ", getVisitor_fname()=" + getVisitor_fname() + ", getVisitor_lname()=" + getVisitor_lname() + ", getVisitor_id()=" + getVisitor_id() + ", getType_of_visit()=" + getType_of_visit() + ", getDate_of_visit()=" + getDate_of_visit() + ", getBorough()=" + getBorough() + ", getSchool()=" + getSchool() + ", getDistrict()=" + getDistrict() + ", getMet_with()=" + getMet_with() + ", getTime_of_visit()=" + getTime_of_visit() + ", getReaction_of_chapter()=" + getReaction_of_chapter() + ", getFollow_up_action()=" + getFollow_up_action() + ", getMeeting_schedule()=" + getMeeting_schedule() + ", getComments()=" + getComments() + ", getTopics_speaker()=" + getTopics_speaker() + ", getTopics_members()=" + getTopics_members() + ", getTime_stamp()=" + getTime_stamp() + ", getNt_user()=" + getNt_user() + ", getRegion()=" + getRegion() + ", getClass()=" + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]"; } } </code></pre> <p>and here is my insert statment:</p> <pre><code>sessionFactory.getCurrentSession().saveOrUpdate(visit); </code></pre> <p>so I don't see why I can be getting this error</p> <p>Here is my jdbc.pro file:</p> <pre><code>database.driver=com.mysql.jdbc.Driver database.url=jdbc:mysql://dvdbm01.dev/svr_dev database.user=jxxxx database.password=xxxx ibernate.dialect=org.hibernate.dialect.MySQL5Dialect hibernate.show_sql=true </code></pre> <p>Here is my database xml file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"&gt; &lt;context:property-placeholder location="classpath:jdbc.properties" /&gt; &lt;context:component-scan base-package="org.uftwf" /&gt; &lt;tx:annotation-driven transaction-manager="hibernateTransactionManager"/&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="${database.driver}" /&gt; &lt;property name="url" value="${database.url}" /&gt; &lt;property name="username" value="${database.user}" /&gt; &lt;property name="password" value="${database.password}" /&gt; &lt;/bean&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="annotatedClasses"&gt; &lt;list&gt; &lt;value&gt;org.uftwf.schoolvisit.model.VisitModel&lt;/value&gt; &lt;value&gt;org.uftwf.schoolvisit.model.NameID_lookupModel&lt;/value&gt; &lt;value&gt;org.uftwf.schoolvisit.model.School_lookupModel&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload