Hi,
I'm developing an application with Eclipse (plugin MyEclpise) where I use Hibernate3 to handle database transactions to MySQL.
But something confuses me!
The application works fine on my develop machine (Window XP, Hibernate3, MySQL 5.0.18-nt, tomcat 5.5.15) but not on my internetserver (Linux, Hibernate3, MySQL 4.1.21-log, tomcat 5.5.20)
Code between sessionFactory.openSession() and session.close():
Example of code that does NOT work on internetserver:
Example 1)
public void save(FreeKeys transientInstance) throws RuntimeException {
Session s = openSession();
Transaction tx = s.beginTransaction();
s.saveOrUpdate(transientInstance);
tx.commit();
tx = null;
closeSession(s);
}
Example 2)
public FreeKeys findById(Long id) {
Session s = openSession();
Transaction tx = s.beginTransaction();
try {
FreeKeys instance = (FreeKeys) s.get("FreeKeys", id);
tx.commit();
return instance;
} catch (RuntimeException re)
...
Example of code that DO work on internetserver:
Session s = openSession();
Transaction tx = s.beginTransaction();
try {
List results = (Criteria) findMoreByExample(s, instance).list();
tx.commit();
return results;
} catch (RuntimeException re)
...
Seems like all queries with Criteria work on both machines!
Can anybody help me! What am I doing wrong?
Thanx in advance!
/Samuel
|