Reputation: 6774
following are my configuration of hibernate:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>${project.groupId}.domain.User</value>
<value>${project.groupId}.domain.Role</value>
<value>${project.groupId}.domain.Permission</value>
<value>${project.groupId}.domain.PermissionCategory</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
</value>
</property>
</bean>
i was wondering if it's possible to make generic definition of annotated classes instead of adding an entry for each class, something like:
<value>${project.groupId}.domain.*</value>
if anyone have an idea, please advise, thanks in advance.
Upvotes: 2
Views: 527
Reputation: 403591
AnnotationSessionFactoryBean
supports the packagesToScan
property as an alternative to annotatedClasses
, so you should be able to do this:
<property name="packagesToScan" value="${project.groupId}.domain">
Upvotes: 3