【发布时间】:2018-09-28 23:52:35
【问题描述】:
我收到一个错误提示
`Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist`
当我尝试创建用户时发生此错误。
@RequestMapping(method = POST)
public UserDto createUser(@RequestBody userDto user) {
Preconditions.checkNotNull(user);
return Preconditions.checkNotNull(service.create(user));
}
但是我可以delete 和get 只是不能create 或update。同样令人沮丧的是,我在尝试update 时没有收到任何错误,但事实并非如此。
我没有得到任何关于去哪里寻找的真正线索。我尝试了许多不同的方法来解决这个问题。
我找到了一个帖子:
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQUENCE1")
@SequenceGenerator(name="SEQUENCE1", sequenceName="SEQUENCE1", allocationSize=1)
private int user_id;
在这个链接:SOF link
它抱怨我用 netbeans 生成的这个实体,我目前正在使用 Intellij。任何意见,将不胜感激。
【问题讨论】:
-
运行
SELECT COUNT(*) FROM user_sequences WHERE sequence_name = 'SHOP_SEQ';时会发生什么?对CAMPAIGN_SEQ执行相同操作。 -
请在您创建活动实体的位置添加代码示例
-
你能调试一下Dao层自动执行的确切查询吗?
-
@SHIVOMPANDEY 我正在输出查询。我声明这是 application.properties
标签: spring-boot jpa spring-data-jpa