Wednesday, 28 September 2011

Tomcat remote debugging from eclipse

To enable debug on tomcat, set the following line in your catalina.bat

DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

From your eclipse, create a Run Configuration for 'Remote Java Application' on socket 8000 and restart tomcat.

Wednesday, 7 September 2011

Auto scan hibernate entity beans like component-scan for general spring components

Use the following configuration to auto scan your hibernate entity beans.

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<property name="dataSource" ref="resourcesDataSource" />
<property name="packagesToScan">
<list>
<value>my.packages.hibernate.domain</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>

</property>
</bean>