您好我正在尝试使用REST开发Spring中的示例项目。我正在使用Spring 4.0.0.release。实现hibernate操作我导入import org.springframework.orm.hibernate3.support.HibernateDaoSupport
,但错误显示The import org.springframework.orm.hibernate3.support.HibernateDaoSupport cannot be resolved
。我的pom.xml包括:
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<!-- HIbernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.0.Final</version>
</dependency>
链接[http://docs.spring.io/autorepo/docs/spring/4.0.0.M3/javadoc-api/index.html?org/springframework/orm/hibernate3/support/HibernateDaoSupport.html][1]表示Spring包含类:org.springframework.orm.hibernate3.support.HibernateDaoSupport
请帮我解决这个问题。任何帮助将不胜感激。
答案 0 :(得分:2)
根据http://mvnrepository.com/artifact/org.springframework/spring-orm/4.0.0.RELEASE
的Maven资料库您应该使用以下内容:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.2.Final</version>
</dependency>
如果不起作用,请尝试3.6.9.Final
获取休眠版本。
答案 1 :(得分:0)
这应该有所帮助。否则,尝试重新启动eclipse,或进行手动安装。
请知道它是否有效。