These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Hibernate
PostPosted: Fri Jan 25, 2008 2:56 am 
Newbie

Joined: Fri Jan 25, 2008 2:39 am
Posts: 4
Location: Bangalore
Hi anyone help me, i m bigner of Hibernate and i wrote one application where i m inserting some records into contact table. when i run the proget i got below bugs..pls help where i did mistake..

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Inserting Record
Done
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:161)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:36)
Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'EMAIL' at row 1
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1669)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1085)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:154)
... 6 more


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 4:33 am 
Newbie

Joined: Thu Jan 24, 2008 4:45 am
Posts: 13
Stack trace says it all: "..Data truncation: Data too long for column 'EMAIL' at row 1..". Validate data.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 5:36 am 
Newbie

Joined: Fri Jan 25, 2008 2:39 am
Posts: 4
Location: Bangalore
sslavic wrote:
Stack trace says it all: "..Data truncation: Data too long for column 'EMAIL' at row 1..". Validate data.


Thanks for suggestion but i had just 8 varchar in email column.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 1:03 pm 
Newbie

Joined: Fri Jan 25, 2008 12:44 pm
Posts: 7
Can you provide the mapping file?

_________________
Yohan Liyanage


Top
 Profile  
 
 Post subject: problem
PostPosted: Sun Jan 27, 2008 1:55 am 
Newbie

Joined: Fri Jan 25, 2008 2:39 am
Posts: 4
Location: Bangalore
Offcource this is my mapping file..

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="roseindia.tutorial.hibernate.Contact" table="CONTACT">
<id name="id" type="long" column="ID" >
<generator class="assigned"/>
</id>

<property name="firstName">
<column name="FIRSTNAME" />
</property>
<property name="lastName">
<column name="LASTNAME"/>
</property>
<property name="email">
<column name="EMAIL"/>
</property>
</class>

<class name="roseindia.tutorial.hibernate.Book" table="book">
<id name="lngBookId" type="long" column="id" >
<generator class="increment"/>
</id>

<property name="strBookName">
<column name="bookname" />
</property>
</class>

<class name="roseindia.tutorial.hibernate.Insurance" table="insurance">
<id name="lngInsuranceId" type="long" column="ID" >
<generator class="increment"/>
</id>

<property name="insuranceName">
<column name="insurance_name" />
</property>
<property name="investementAmount">
<column name="invested_amount" />
</property>
<property name="investementDate">
<column name="investement_date" />
</property>
</class>



</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 30, 2008 3:55 pm 
Newbie

Joined: Fri Nov 30, 2007 7:23 am
Posts: 3
please check the size of the email String before inserting it, maybe it is bigger that 8 . Also, you could try to add in your mapping file something like : <property name="email" length="123">


Top
 Profile  
 
 Post subject: hibernate
PostPosted: Thu Jan 31, 2008 3:37 am 
Newbie

Joined: Fri Jan 25, 2008 2:39 am
Posts: 4
Location: Bangalore
Hi i has written one console based program using hibernate . i have taken one table like "contact" in that i inserted some value, i did all the thing when i run the application in eclips its showing below the output. but records r not inserting in the database ..i m not getting where is the problem ..

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Inserting Record
Done
Hibernate: insert into CONTACT (FIRSTNAME, LASTNAME, EMAIL, ID) values (?, ?, ?, ?)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.