Win a copy of Cloud Native Transformation: Practical Patterns for InnovationE this week in the Cloud/Virtualization forum
or The Go Workshop in the Go forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Joe Ess
  • salvin francis

hibernate problem

Ranch Hand
Posts: 156
Hibernate Eclipse IDE 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.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) { = id;

public String getName() {
return name;

public void setName(String 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.
rubbery bacon. rubbery tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!