For my current project we needed to use the StatelessSession to achieve better performance. I have build some framework code so we are able to use the StatelessSession together with a (Stateful) HibernateEntityManager and let it join the same transaction. This works more or less the same as how you can mix an EntityManager together with the JdbcTemplate (use the same connection).
Since there are many requests on the web for this kind of behavior I would like to give our solution to the community in the hope you could benefit from it. The code is attached to this issue and is tested using spring 3.2.0.RELEASE and hibernate 4.1.9.Final.
To use this just add the bean to your existing context configuration:
<bean class="com.acme.spring.data.support.hibernate.StatelessSessionFactoryBean" />
And @AutoWired the StatelessSession in you DAO's:
@AutoWired private StatelessSession statelessSession;
Please note that this code will only work with the JpaTransactionManager and (of-course) Hibernate as the Jpa implementation. It also doesn't support suspending of transactions (i.e.: PROPAGATION_REQUIRES_NEW, PROPAGATION_NOT_SUPPORTED).