Wow Marten, now you got me confused here.
The book I'm following (Manning: "Spring in Action", 2nd Ed) uses the annotated model classes as the entities to be used in the XML configuration for sessionFactory (in applicationContext.xml). The exact code provided by the book for this configuration is:
Code:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.roadrantz.domain.Rant</value>
<value>com.roadrantz.domain.Motorist</value>
<value>com.roadrantz.domain.Vehicle</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
</props>
</property>
</bean>
As said in the book just after presenting this code:
"However, instead of configuring one or more mapping files, we must configure AnnotationSessionFactoryBean with one or more classes that are annotated for persistence with Hibernate. Here we’ve listed the domain objects in the RoadRantz application."
As you can see, I adjusted the code with my own domain objects (POJO classes annotated for Hibernate persistence) and, as I already had a Hibernate configuration file, I replaced the "hibernateProperties" property with a reference to my hibernate.cfg.xml file previously created by NetBeans.
Once again, my applicationContext.xml using the annotatedClasses property for sessioNFactory configuration is at this link.
The book configures the Hibernate-backed DAO beans with the code
Code:
<bean id="rantDao" class="com.roadrantz.dao.hibernate.HibernateRantDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
and, as you can see in my first post, I adjusted my XML accordingly.
Reading your last comment, I'm afraid I couldn't abstract the difference you see between "entity" and "class". In my point of view, an "entity" is a model class correctly annotated for persistence. Am I missing something here?