-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate dosn't work when app startup for the first time
PostPosted: Fri Mar 06, 2009 12:08 pm 
Beginner
Beginner

Joined: Mon Feb 02, 2009 3:22 am
Posts: 26
Hello all,

I am facing a wierd problem with Hibernate.

I am developing a Swing application that access MySQL by Hibernate. My developent envioroment is MyEclipse. Everything works fine in MyEclipse.
After that use InstallShield to generate a setup.exe for my application.

In order to generate the setup.exe, I do the following steps:
1. generate a fatjar file, bill.jar, for instance
2. convert bill.jar to bill.exe by Jsmooth
3. put bill.exe and other file into setup.exe by InstallShield

I run setup.exe to install the application, then run the application.

The wierd part is all the query dosn't return any result for the first time I run the application. But everything works fine after I stop it and re-run.

I check my log file, and see that Hibernate is configured , and no exception during the application is run. the HQL str is somethning like :

from Bill where calldate >= '2009-02-06 00:00:00' and calldate <= '2009-03-06 23:59:59'

the query code is the following:
public List queryList(String hql)
{
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery(hql);
List list = query.list();
return list;
}

There are many records in MySQL database, but the queryList(String hql) method return a list of size 0. The same situation with all other HQL.

I just can't explain why hibernate dosn't work for the first time the app is run, but works fine since the second time. Does anybody can explain? and tell me how to solve this problem?

Thanks in advance.

Yhqian99


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.