Hello,
I have implemented Gavin's blog on Internationalized Data
http://blog.hibernate.org/cgi-bin/blosxom.cgi/2004/06/23#i18n) and have implemented the second-level cache as shown below for a Label hibernate class. For some reason, it appears as though the Label objects are never being cached as I never see a "adding entity to second-level cache" or any sort of ehcache debug statements.
Is there something else that I need to do to have the Label objects cached? I see the cache debugs for my other objects so I know that the cache is working.
Thanks for any help,
Rexxe
Hibernate version: 2.1.7
Mapping documents: Only relevant part of mapping shown.
Code:
<class
name="foo.dto.Label"
table="LABEL"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>
<cache usage="read-only" />
Code between sessionFactory.openSession() and session.close():Using Spring:
Code:
public String getDescription(Long code, Locale locale) {
String query = "select l.description from foo.dto.Label l "
+ "where l.id.code = (:code) and l.id.language = (:language)";
return (String) getHibernateTemplate().findByNamedParam(query,
new String[] { "code", "language" },
new Object[] { code, locale.getLanguage() }).get(0);
}
Name and version of the database you are using: PostgreSQL 8.0 Beta 4 on Win XP Pro
The generated SQL (show_sql=true):Code:
[DEBUG] 11:23:20 SQL - select label0_.description as x0_0_ from LABEL label0_ where (label0_.code=(?))and(label0_.language=(?))