• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate problem

santhoshkumar samala
Ranch Hand
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic