File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Strange error when using Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Strange error when using Hibernate" Watch "Strange error when using Hibernate" New topic

Strange error when using Hibernate

Hakan Axheim

Joined: Nov 24, 2008
Posts: 9
I'm really new to Hibernate. I use both Spring and Hibernate. I am almost finished with my test application. Everything works fine and I see with MySQL Query Browser that records will be inserted into the database from my Web browser. I have also made a web page that reads records from my database and I see all my insterted records in that web page.

Now, to the strange part!

After a while - maybe 5-10 minutes all my inserted data will disappear from the database. Why? Can someone help med describe that? Is autocommit turned off? Some default value that must be changed?

This is my mapping file;

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"


<class name="businessLayer.Project" table="project">
<id name="id" column="id" type="java.lang.Integer">
<generator class="native"/>
<property name="ProjectId" type="java.lang.Integer"/>
<property name="ProjectNumber" type="java.lang.Integer"/>
<property name="ProjectName" type="java.lang.String"/>

Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
do you have the following set in your hibernate.cfg.xml

If yes, comment out this setting and see if it works

I agree. Here's the link:
subject: Strange error when using Hibernate
jQuery in Action, 3rd edition