Hello Hibernate User..
I have two web application that is using the same Oracle 10g database. One application-A is able to update/save/delete "Messages" into a table. The other application-B is able to retrieve the "Messages" and display the content of this message into a webpage.
I have been struggling trying to setup application-B to retrieve updated "Messages" after application-A makes changes to the message. For example, application-A creates a new message that says "Message-1". application-B then goes to a page and it retrieves this "Message-1". Then application-A updates this message to "Message-2". application-B goes to that same page to retrieve the message, but the retrieval from the db is still showing that the message content is "Message-1"
Is this issue I'm having related to the way hibernate caches queries?
Any help would be reallly appreciate! really desperate to fix this issue :)
Here's my hibernate setting for application-B:
Code:
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.current_session_context_class=thread
hibernate.id.new_generator_mappings=true
hibernate.connection.release_mode=after_transaction
</value>
</property>
Here's the code snippet trying to retrieve the "Message", *SiteDestination is the object that contains the message
Code:
public List<SiteDestination> getSiteDestinationForNewLogin() throws RepositoryException {
List<SiteDestination> result = null;
try {
sessionFactory.getCurrentSession().beginTransaction();
result = sessionFactory.getCurrentSession().createQuery(
"from SiteDestination as siteDestination where siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ? or siteDestination.siteDestinationCode = ?")
.setString(0, Constants.NEW_LOGINS_DISABLE)
.setString(1, Constants.NEW_LOGINS_SESSIONS_DISABLE)
.setString(2, Constants.REDIRECT_LOGIN_PAGE)
.setString(3, Constants.REDIRECT_ERROR_PAGE)
.setCacheable( false )
.list();
} catch (Exception ex) {
... exception handling code ..
} finally {
sessionFactory.evict(SiteDestination.class);
}
return result;
}