String xmlpath = "caminho/applicationContext-hibernate.xml";
ApplicationContext path =
new FileSystemXmlApplicationContext(xmlpath);
LocalSessionFactoryBean lsfb = (LocalSessionFactoryBean) path.getBean("sessionFactory");
Exception in thread "main" java.lang.ClassCastException: org.hibernate.impl.SessionFactoryImpl cannot be cast to org.springframework.orm.hibernate3.LocalSessionFactoryBean
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.postgresql.Driver</value>
</property>
<property name="url">
<value>jdbc:postgresql://127.0.0.1:5432/security</value>
</property>
<property name="username">
<value>postgres</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="configLocation" value="br/com/wat/hibernate.cfg.xml">
</property>
</bean>
ta aí, não sei o que to fazendo
(to tentando rodar isso fora do contexto do servidor)
alguem tem uma luz pra mim? :D
abraços