Thank you all for your suggestions.
khangharoth:
1&2) I'm definitely committing the changes and they're being reflected in the database immediately when the HibernateUtil.commitTransaction(); executes. I know this because I watch the database in terminal.
3) If this problem persists (most likely will) I will make a really compact version of the problem and post it on this forum... I can't do that right now though because I'm in a bit of a crunch to finish up another project as well.
ramnath:
Yeah I thought that would be the problem, but oddly enough the objects that I'm looking at (through Eclipse's Debugger) are all initialized. In my mind initialized should mean up-to-date with the database... but that's not the case. After executing this code:
Code:
HibernateUtil.beginTransaction();
Long userId = (Long)session.getAttribute("userId");
User user = userDAO.findById(userId, true);
Where the findById is simply calling this code:
Code:
public T findById(ID id, boolean lock) {
try {
T entity;
if (lock) {
entity = (T) getSession().get(getPersistentClass(),id,LockMode.UPGRADE);
} else {
entity = (T) getSession().get(getPersistentClass(), id);
}
return entity;
} catch (HibernateException e) {
log.error("unable to find by id=" + id + " entity="+ getPersistentClass());
return null;
}
}
After executing that chunk of code, which should simply grab the object out of the database, initialized values inside the User I'm accessing are inaccurate. I've tried initializing them again... in hopes that that would double check the values form the DB or something but no go.
schauder:
This suggestion got me really excited... maybe if I just tweak the hibernate.cfg.xml I could fix everything. Alas no go. Without much testing the values being loaded in my User were inaccurate. These are the properties I have in my cfg.xml:
Code:
hibernate.current_session_context_class: thread
hibernate.default_batch_fetch_size: 16
hibernate.connection.isolation: 8 //TRANSACTION_SERIALIZABLE
and I also turned off any caching... thinking that might help
Code:
hibernate.cache.use_query_cache: false
hibernate.cache.use_second_level_cache: false
Once again thank you guys for your suggestions.
-Tommy