Java Reference
In-Depth Information
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager"
lazy-init="true">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="placeholderProperties"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:batch.properties" />
<property name="systemPropertiesModeName"
value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
</bean>
</beans>
As you can see, the vast majority of launch-context.xml is the default. The main changes are the
addition of the JMS resources and Hibernate resources at the end. Note the TransactionManager
configured by default has been replaced with the one you're using for this job.
The last piece of configuration that you need to do in order for the pieces of this job to work together
is the hibernate.cfg.xml file. Because you're using annotations to do the mapping, the
hibernate.cfg.xml file is nothing more than a list of classes that are mapped. Listing 11-11 contains the
source of the file for this example.
 
Search WWH ::




Custom Search