-->
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.  [ 5 posts ] 
Author Message
 Post subject: Insertion Problem Urgent
PostPosted: Mon Jul 11, 2005 6:49 pm 
Newbie

Joined: Mon Mar 07, 2005 7:18 pm
Posts: 16
Friends,

I'm new to Hibernate.

When I try to insert a row in the table - I get 'inserted value too large for the column' -

Here's my mapping

hibernate-mapping>
<class name="com.omx.common.resource.hibernate.beans.CompanyList" table="company_list">
<id name="companyID" column="COMPANY_ID" type="long" unsaved-value="null">
<generator class="sequence">
<param name="sequence">COMPANY_SEQ</param>
</generator>
</id>

<property name="companyName" column="COMPANY_NAME" type="string" not-null="true"/>
<property name="companyState" column="COMPANY_STATE" type="string" not-null="true"/>
<property name="lastModBy" column="LAST_MOD_BY" type="string"/>
<property name="lastModDate" column="LAST_MOD_DATE" type="date" not-null="true"/>

and here's my java code


Session session = HibernateSession.currentSession();
Transaction tx = session.beginTransaction();
CompanyList c = new CompanyList();
//c.setCompanyID(new Long(222222));
c.setLastModBy("RAM");
c.setLastModDate(new java.util.Date());
c.setCompanyName("RAMS");
c.setCompanyState("IL");
c.setOriginator("RAM");
c.setCreationDate(new java.util.Date());

session.save(c);
tx.commit();
session.close();

I tried to set the primary key from my application and it didn't work. so I commented that out.


Thanks for your time.

Ram

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 6:59 pm 
Beginner
Beginner

Joined: Fri Jul 08, 2005 12:38 pm
Posts: 41
Location: Massachusetts, USA
It sounds like one of your strings is too big for the varchar column in the database.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 7:04 pm 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Show the table definiton of company_list, especially the length of your columns.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 7:41 pm 
Newbie

Joined: Mon Mar 07, 2005 7:18 pm
Posts: 16
Here's the db structure (Oracle DB)

COMPANY_ID NUMBER NOT NULL,
SUPLR_ID NUMBER,
COMPANY_NAME VARCHAR2(50 BYTE) NOT NULL,
COMPANY_STATE VARCHAR2(1 BYTE) DEFAULT 'A' NOT NULL,
LOGO_FILENAME VARCHAR2(12 BYTE),
ADDRESS1 VARCHAR2(50 BYTE),
ADDRESS2 VARCHAR2(50 BYTE),
CITY VARCHAR2(30 BYTE),
STATE VARCHAR2(30 BYTE),
COUNTRY_ID NUMBER,
ZIP VARCHAR2(10 BYTE),
ZIP_EXT VARCHAR2(20 BYTE),
ORIGINATOR VARCHAR2(17 BYTE) NOT NULL,
LAST_MOD_BY VARCHAR2(17 BYTE),
LAST_MOD_DATE DATE NOT NULL,
CREATION_DATE DATE DEFAULT sysdate

Thanks for your time.

Ram n


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 8:06 pm 
Newbie

Joined: Mon Mar 07, 2005 7:18 pm
Posts: 16
You're right. I found the problem. It was large string data i was trying to insert.

Appreciate your help.

Thanks
Ram N.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.