Performance problem if cached entity has attribute state with an expensive toString() method (LOB, etc)

Description

If you have an entity that has an expensive (regarding cpu load) toString() method you find a serious performance penalty using the cache.
net.sf.ehcache.pool.impl.DefaultSizeOfEngine.java calls 'LOG.warn("value"+value);' using a NOPLogger even if you switch off log4j for everything.
org.hibernate.cache.spi.entry.StandardCacheEntryImpl.java contains a toString() method that is called from the above code and if you have like in mine case a blob object in your hibernate entity that uses an AbstractSingleValueConverter for conversion of an entity to xml that uses the toString() method you might get surprising performance problems. At least I am not aware of a warning in the documentation to overload toString() when using hibernate. The workaround seems to be simple, just do not use code within toString() that might be slow even if you never call it.

Environment

ehcache as cache

Status

Assignee

Steve Ebersole

Reporter

Carsten Hammer

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.1.1

Priority

Major
Configure