I spotted this which might be one solution to my problem:
http://opensource2.atlassian.com/projec ... 4?page=all
It appears that configuration property
Code:
hibernate.ejb.interceptor
can be set in the persistence.xml file to specify some class which implements org.hibernate.Interceptor. I presume that an instance of that class will then be created and attached to every EJB EntityManager created by Hibernate.
According to the bugreport above, this feature has been committed to CVS and will be available in hibernate 3.1-beta3.
I would still be interested in hearing about any pure-EJB3 solution to this, ie one that doesn't require implementing an org.hibernate interface directly.