【发布时间】:2011-08-05 09:46:39
【问题描述】:
我刚刚开始在我的基于 Sping+Hibernate 的项目 (JDK 1.6.0_23) 中为我的 POJO 映射使用 hibernate 注释,我收到了关于类之间不兼容的错误。 sessionFactory 配置为:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="namingStrategy">
<bean class="org.hibernate.cfg.ImprovedNamingStrategy" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">no</prop>
<prop key="hibernate.connection.isolation">3</prop>
<prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory </prop>
<prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
</props>
</property>
</bean>
在我的 Maven 项目文件中,我设置了以下依赖项: javax.persistence 持久性API 1.0 罐 错误的 org.hibernate 休眠注释 ${休眠版本} 罐 错误的 org.hibernate 休眠核心 ${休眠版本} 罐 错误的 org.hibernate 休眠-ehcache ${休眠版本} 罐 错误的 2.5.5 3.5.6-决赛 0.5
谁能给我一个关于如何解决问题的提示? 谢谢
彼得
【问题讨论】:
-
我刚刚解决了这个问题。似乎其他项目依赖项之一(从 atomicos 命名“transactions-essentials-all”)在部署中引入了 hibernate core 3.2.5.ga。我已经编写了一个具有该依赖项的嵌套排除项,并且所有工作都很棒