• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

hibernate problem

Ranch Hand
Posts: 156
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am learning hibernate
I am writting a jsp file.
I am using tomcat, and database as SAP DB

but it is giving this exception.

"net.sf.hibernate.JDBCException: Could not synchronize database state with session: SAP DBTech JDBC: Parameter 2: value too large. exception"

my jsp file is

<%@ page language="java" %>
<%@ page import="category.Cat"%>
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<title>Lomboz JSP</title>
<%@ page import="HibernateUtil,java.io.*,java.sql.*,net.sf.hibernate.cfg.Configuration,net.sf.hibernate.SessionFactory,net.sf.hibernate.Session,net.sf.hibernate.Transaction,net.sf.hibernate.MappingException" %>
<body bgcolor="#FFFFFF">

Session sess=null;
Configuration cfg = new Configuration();
SessionFactory sessions = cfg.buildSessionFactory();
sess = sessions.openSession();
Transaction tx = null;
Cat c=new Cat();

tx = sess.beginTransaction();
catch (Exception e ) {
finally {



and my Cat file is

package category;

public class Cat {

private String id;
private String name;

public Cat()

public Cat(String id,String name) {

public String getId() {
return id;

private void setId(String id) {
this.id = id;

public String getName() {
return name;

public void setName(String name) {
this.name = name;


and my Cat.hbm file is

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
<class name="category.Cat" table="cat">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="id" type="string" unsaved-value="null">
<column name="id" sql-type="char(10)" not-null="true"/>
<generator class="uuid.hex"/>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="name">
<column name="name" length="10" not-null="true"/>

and my hibernate.cfg is

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
<property name="connection.datasource">java:comp/env/jdbc/mysap</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.SAPDBDialect</property>
<!-- Mapping files -->
<mapping resource="Cat.hbm.xml"/>

and my srever.xml contains

<Context path="/quickstart" docBase="quickstart">
<Resource name="jdbc/mysap" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/mysap">

and the data base fields are



then what is the problem.plz help me.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic