ody*_*eas 3 java orm hibernate spring-mvc
我在 Hibernate 中使用 Spring ORM,当我编写命令时
hibernateTemplate.save(entityInstance);
Run Code Online (Sandbox Code Playgroud)
(entityInstance 显然是一个 User 实体的实例)
我收到此错误:
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
Run Code Online (Sandbox Code Playgroud)
即使我按照(工作)教程一步一步(和逐个代码)它也不起作用。这是我的 pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dsystems</groupId>
<artifactId>newtokenmanager</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>newtokenmanager Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.5.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
Eclipse 还建议我从菜单中配置构建路径的“快速修复”,但我不知道该怎么做。正如一些人在 SO 上针对类似问题建议的那样,我尝试删除并重新加载 JRE 系统库和 Maven 依赖项,但没有奏效。
小智 7
为 Maven 项目添加 pom
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
或添加 jar spring-tx
| 归档时间: |
|
| 查看次数: |
14975 次 |
| 最近记录: |