The Hibernate Module

The hibernate module has today only one class, but it helps a lot. This class is a replacement for the AnnotationSessionFactoryBean of Sring Framework, the main advantage is that the one provided here scan your classpath (just the places that contains a in the root), for any classes annotated with @javax.persistence.Entity and adds it atomatically to your SessionFactory. It solves a common problem in some clients of mine who forgot to register one or two entities in the hibernate.cfg.xml file. to use this module you just need to use the following class to configure your Session Factory (by XML or programatically) net.sourceforge.sannotations.hibernate.AutomaticAnnotationSessionFactoryBean for example, like this:

<bean id="sessionFactory" class="net.sourceforge.sannotations.hibernate.AutomaticAnnotationSessionFactoryBean">

<property name="configLocations" value="classpath*:hibernate.cfg.xml" />

<property name="schemaUpdate" value="false" />

<property name="dataSource" ref="dataSource" />

<property name="exposeTransactionAwareSessionFactory" value="false" />