-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate hangs with no error output
PostPosted: Thu Jun 05, 2008 5:35 am 
Newbie

Joined: Fri May 30, 2008 7:44 am
Posts: 5
Hello,

I use Hibernate v3.1.3 with HSQLDB v1.7.3.3, for a few months.

My application get stuck on a serie of "insert" commands, with no Hibernate error in the output console.

When executing the code in the bottom of the page, I get the following output, then nothing else in the console, and a still running JVM :

--
Code:
[java] Hibernate: select next value for hibernate_sequence from dual_hibernate_sequence
[java] Hibernate: select next value for hibernate_sequence from dual_hibernate_sequence
[java] Hibernate: select next value for hibernate_sequence from dual_hibernate_sequence
[java] Hibernate: select next value for hibernate_sequence from dual_hibernate_sequence
[java] Hibernate: select next value for hibernate_sequence from dual_hibernate_sequence

... (up to nearly 10 lines)

--

If I disconnect from the HSQLDB database before the Java faulty segment, it works fine and I get this output, in addition/following the previously presented output :

--
Code:
[java] Hibernate: /* insert Packet */ insert into packet (packetinformation, identifier) values (?, ?, ?, ?, ?)
[java] Hibernate: /* insert Information */ insert into information (identifier) values (?)
[java] Hibernate: /* insert Share */ insert into share (packet, subgroup, shareinformation, identifier) values (?, ?, ?, ?)

--

Do you have any idea how I could solve this, or at least determine what is the faulty element in it (programmer error, HSQLDB and Hibernate uncomptibilities, ..) ?

Here are Java source and Hibernate configuration files samples, if usefull :

-- Java faulty part --
Code:
Share share;

share = null;

Share = new Share();

share.setPacket(packet);
share.setSubgroup(subgroup);

share.save();

--

-- Java Hibernate and HSQLDB management --
Code:
// save
sessionFactory.openSession();
sessionFactory.getCurrentSession().beginTransaction();
sessionFactory.getCurrentSession().saveOrUpdate(obj);
sessionFactory.getCurrentSession().flush();
sessionFactory.getCurrentSession().clear();
sessionFactory.getCurrentSession().getTransaction().commit();

// load
sessionFactory.getCurrentSession().beginTransaction();
return sessionFactory.getCurrentSession().load(classtype,id);

--

-- Hibernate --
Code:
<class name="Share" table="share" lazy="false">
   <id name="identifier" column="identifier" type="long" unsaved-value="0">
      <generator class="sequence" />
   </id>
   <many-to-one name="packet" column="packet" class="Packet" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
   <many-to-one name="subgroup" column="subgroup" class="Subgroup" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
   <many-to-one name="information" column="shareinformation" class="Information" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
</class>
   
<class name="Packet" table="packet" lazy="false">
   <id name="identifier" column="identifier" type="long" unsaved-value="0">
      <generator class="sequence" />
   </id>
   <many-to-one name="cipherContent" column="ciphercontent" class="CipherContent" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
   <many-to-one name="right" column="right" class="Right" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
   <many-to-one name="information" column="packetinformation" class="Information" not-null="true" cascade="persist,all,save-update,delete" lazy="false" />
   <property name="owner" column="owner" type="string" not-null="true" lazy="false" />
</class>

<class name="Vertex" table="vertex" lazy="false">
   <id name="identifier" column="identifier" type="long" unsaved-value="0" access="field">
      <generator class="sequence" />
   </id>
   <property name="index" column="index" type="integer" not-null="true" access="field" lazy="false" />
   <union-subclass name="Subgroup" table="subgroup" lazy="false">
      <many-to-one name="information" column="subgroupinformation" class="Information" unique="true" not-null="true" access="field" cascade="persist,all,save-update,delete" lazy="false" />
      <list name="member" table="memberlist" access="field" cascade="persist,all,save-update,delete" lazy="false">
         <key column="identifier" />
         <list-index column="memberidentifier" />
         <many-to-many column="memberobject" class="Actor" lazy="false" />
      </list>
   </union-subclass>
</class>

--

It's a lot of code, but I chose the essential parts and didn't threw you the whole bunch of work.

I must solve this and can't disconnect, then reconnect to the database, to get rid of this. Disconnect/reconnect takes at least 10 seconds in my application (I don't know why, I just suppose it's because I don't try to use lazy loading).

Thanks for help :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 5:43 am 
Regular
Regular

Joined: Wed Apr 09, 2008 10:28 am
Posts: 52
Do you use a logger? if not check this out -> http://ideoplex.com/id/386/controlling- ... with-log4j

i had similar behavoirs that i dont get any exceptions but somethings didnt work after i added a logger into my application i finally saw the errors on the console.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 05, 2008 7:34 am 
Newbie

Joined: Fri May 30, 2008 7:44 am
Posts: 5
Thanks for reply kukudas, but it didn't help, since I already configured Log4j output :

Most of the time, I get Hibernate debug messages and errors in output (screen, file, ..), that's errors like ".. cannot be null", "Two objects with the same identifier ..", .. But this time, I get nothing.

Here is additional information from the still running JVM, and so, HSQLDB connection.

The last lines of the database "database.log file" :

--
Code:
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 95
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 96
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 97
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 98
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 99
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 100
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 101
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 102
/*C2*/CONNECT USER SA
SET AUTOCOMMIT FALSE
DELETE FROM HIBERNATE_UNIQUE_KEY WHERE NEXT_HI=0
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(1)
COMMIT
/*C1*/ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 103
/*C3*/CONNECT USER SA
SET AUTOCOMMIT FALSE
DELETE FROM HIBERNATE_UNIQUE_KEY WHERE NEXT_HI=1
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(2)
COMMIT
/*C1*/ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 104
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 105
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 106
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 107

--

The last lines of the database "database.script" file (I believe this file is only written when invoking the shutdown command, that I issue when unloading the Java application) :

--
Code:
INSERT INTO SUBGROUP VALUES(17,8,NULL,18)
INSERT INTO SUBGROUP VALUES(19,9,NULL,20)
INSERT INTO SUBGROUP VALUES(35,1,36,37)
INSERT INTO SUBGROUP VALUES(38,2,39,40)
INSERT INTO SUBGROUP VALUES(41,3,42,43)
INSERT INTO SUBGROUP VALUES(44,4,45,46)
INSERT INTO SUBGROUP VALUES(47,5,48,49)
INSERT INTO SUBGROUP VALUES(50,6,51,52)
INSERT INTO SUBGROUP VALUES(53,7,54,55)
INSERT INTO SUBGROUP VALUES(56,8,57,58)
INSERT INTO SUBGROUP VALUES(59,9,60,61)
INSERT INTO SUBGROUPLIST VALUES(1,3,0)
INSERT INTO SUBGROUPLIST VALUES(1,5,1)
INSERT INTO SUBGROUPLIST VALUES(1,7,2)
INSERT INTO SUBGROUPLIST VALUES(1,9,3)
INSERT INTO SUBGROUPLIST VALUES(1,11,4)
INSERT INTO SUBGROUPLIST VALUES(1,13,5)
INSERT INTO SUBGROUPLIST VALUES(1,15,6)
INSERT INTO SUBGROUPLIST VALUES(1,17,7)
INSERT INTO SUBGROUPLIST VALUES(1,19,8)
INSERT INTO SUBGROUPLIST VALUES(33,35,0)
INSERT INTO SUBGROUPLIST VALUES(33,38,1)
INSERT INTO SUBGROUPLIST VALUES(33,41,2)
INSERT INTO SUBGROUPLIST VALUES(33,44,3)
INSERT INTO SUBGROUPLIST VALUES(33,47,4)
INSERT INTO SUBGROUPLIST VALUES(33,50,5)
INSERT INTO SUBGROUPLIST VALUES(33,53,6)
INSERT INTO SUBGROUPLIST VALUES(33,56,7)
INSERT INTO SUBGROUPLIST VALUES(33,59,8)
INSERT INTO TEMPLATE VALUES(1,'grouptemplatable',1)
INSERT INTO DUAL_HIBERNATE_SEQUENCE VALUES(0)
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(0)

--

When all goes well, as described in the original post, I get the following HSQLDB results :

--
Code:
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(3)
COMMIT
/*C1*/ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 116
/*C3*/CONNECT USER SA
SET AUTOCOMMIT FALSE
DELETE FROM HIBERNATE_UNIQUE_KEY WHERE NEXT_HI=3
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(4)
COMMIT
/*C1*/ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 117
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 118
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 119
ALTER SEQUENCE HIBERNATE_SEQUENCE RESTART WITH 120
INSERT INTO PACKET VALUES(108,109,113,118,'customer')
INSERT INTO INFORMATION VALUES(119)
INSERT INTO SHARE VALUES(107,108,47,119)
COMMIT

--

--
Code:
INSERT INTO SUBGROUP VALUES(17,8,NULL,18)
INSERT INTO SUBGROUP VALUES(19,9,NULL,20)
INSERT INTO SUBGROUP VALUES(35,1,36,37)
INSERT INTO SUBGROUP VALUES(38,2,39,40)
INSERT INTO SUBGROUP VALUES(41,3,42,43)
INSERT INTO SUBGROUP VALUES(44,4,45,46)
INSERT INTO SUBGROUP VALUES(47,5,48,49)
INSERT INTO SUBGROUP VALUES(50,6,51,52)
INSERT INTO SUBGROUP VALUES(53,7,54,55)
INSERT INTO SUBGROUP VALUES(56,8,57,58)
INSERT INTO SUBGROUP VALUES(59,9,60,61)
INSERT INTO SUBGROUPLIST VALUES(1,3,0)
INSERT INTO SUBGROUPLIST VALUES(1,5,1)
INSERT INTO SUBGROUPLIST VALUES(1,7,2)
INSERT INTO SUBGROUPLIST VALUES(1,9,3)
INSERT INTO SUBGROUPLIST VALUES(1,11,4)
INSERT INTO SUBGROUPLIST VALUES(1,13,5)
INSERT INTO SUBGROUPLIST VALUES(1,15,6)
INSERT INTO SUBGROUPLIST VALUES(1,17,7)
INSERT INTO SUBGROUPLIST VALUES(1,19,8)
INSERT INTO SUBGROUPLIST VALUES(33,35,0)
INSERT INTO SUBGROUPLIST VALUES(33,38,1)
INSERT INTO SUBGROUPLIST VALUES(33,41,2)
INSERT INTO SUBGROUPLIST VALUES(33,44,3)
INSERT INTO SUBGROUPLIST VALUES(33,47,4)
INSERT INTO SUBGROUPLIST VALUES(33,50,5)
INSERT INTO SUBGROUPLIST VALUES(33,53,6)
INSERT INTO SUBGROUPLIST VALUES(33,56,7)
INSERT INTO SUBGROUPLIST VALUES(33,59,8)
INSERT INTO TEMPLATE VALUES(1,'grouptemplatable',1)
INSERT INTO DUAL_HIBERNATE_SEQUENCE VALUES(0)
INSERT INTO HIBERNATE_UNIQUE_KEY VALUES(2)

--


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 06, 2008 3:46 am 
Newbie

Joined: Fri May 30, 2008 7:44 am
Posts: 5
Any idea please ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 06, 2008 11:57 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
What is the LockMode that you are using?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 9:18 am 
Newbie

Joined: Fri May 30, 2008 7:44 am
Posts: 5
Hello,

Sorry for answering so late. I put that problem apart to work on the application installer, and comme back to the problem now.

I don't use any LockMode in my Hibernate code (so, if a default value is chosen by Hibernate API, this is the one I use :) )

I tracked down the 'lock' and 'lck' keywords in my code, hibernate properties, and hsqldb properties, and found nothing (just the hsqldb .lck file that is created at database connection, and deleted at database disconnection time).

In Hibernate documentation, LockMode is part of the API, so I'm sure never to have imported/used it in my sources.

What else may be wrong so ? I restart to search and give you news if something changes.

'Good day, night


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 12, 2008 6:22 am 
Newbie

Joined: Fri May 30, 2008 7:44 am
Posts: 5
I found out that :

- at first application runtime, object is initialized in memory, then saved in db : Hibernate then stuck on the db insert/update I do on this object.

- following runtimes just go well for db insert/update on this object.

Does this "first application runtime" issue reminds you some point ?


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