I execute a named query with an alias to bean result transformer and EHCache query cache activated
Code:
Query query=session.getNamedQuery("Articles.byName");
query.setParameter("name",name);
query.setResultTransformer(Transformers.aliasToBean(ArticleVO.class));
query.list();
Code:
<query name="Articles.byName" cacheable="true">
<query-param name="name" type="string"/>
<![CDATA[
select article.id as idArticle, article.name as nameArticle,
from Article article
where article.name like :name
]]>
</query>
I get the following exception
Quote:
2009-05-13 15:21:15,502 [Store org.hibernate.cache.StandardQueryCache Spool Thread] ERROR net.sf.ehcache.store.DiskStore - ettele.org.hibernate.cache.StandardQueryCacheCache: Failed to write element to disk 'sql: select ...; max rows: 100; transformer: org.hibernate.transform.AliasToBeanResultTransformer@377a0c88'. Initial cause was org.hibernate.property.ChainedPropertyAccessor
java.io.NotSerializableException: org.hibernate.property.ChainedPropertyAccessor
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:75)
at net.sf.ehcache.store.DiskStore.writeElement(DiskStore.java:689)
at net.sf.ehcache.store.DiskStore.writeOrReplaceEntry(DiskStore.java:679)
at net.sf.ehcache.store.DiskStore.flushSpool(DiskStore.java:651)
at net.sf.ehcache.store.DiskStore.throwableSafeFlushSpoolIfRequired(DiskStore.java:628)
at net.sf.ehcache.store.DiskStore.spoolAndExpiryThreadMain(DiskStore.java:596)
at net.sf.ehcache.store.DiskStore.access$800(DiskStore.java:64)
at net.sf.ehcache.store.DiskStore$SpoolAndExpiryThread.run(DiskStore.java:1033)
I am using:
- Hibernate Core 3.3.1.GA
- Hibernate Annotations 3.4.0.GA
- EHCache 1.5.0
- Java 1.6.0_10
Is it a known bug? I can't find it in the bug tracker.