See Ehcache's SizeOfEngine module for details, but to put it simply: adding this dependency to your pom.xml, will have Ehcache's Automatic Resource Control (aka ARC) size Hibernate4 caches correctly.
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>sizeofengine-hibernate</artifactId>
<version>0.9.0</version>
</dependency>
Not yet pushed to maven central, you'll have to install both this module and the ehcache-sizeofengine modules locally first.