java - 无法提取结果集; SQL [不适用];嵌套异常是 org.hibernate.exception.SQLGrammarException : could not extract ResultSet with oauth

标签 java spring-boot jpa oauth-2.0

我正在使用 java spring boot 进行休息服务。这些表在数据库中正确创建,并在本地测试一切正常,但是当我在我的 vps 中的 tomcat 中安装 .war 时,失败开始。

对/oatuh/ token 执行 POST 请求来登录会引发异常:

"could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet"

附图: enter image description here

用户实体:

 @Entity
 @Table(name = "users")
 public class UserEntity implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = -7125479784396028079L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
private Long id;

@Column(name = "username", unique = true)
private String username;

@Column(name = "password")
private String password;

@Column(name = "email", unique = true)
private String email;

DAO:

@Repository
public interface UserDao extends JpaRepository<UserEntity, Long>{

@Query("select u from UserEntity u where u.username = ?1")
public UserEntity findByUsername(String username);

}

服务:

@Override
@Transactional(readOnly = true)
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    UserEntity user = userDao.findByUsername(username);
    System.out.println(user);

    if (user == null) {
        log.error("El usuario no existe en la base de datos.");
        throw new UsernameNotFoundException("Usuario inexistente en la base de datos");
    }

    return new User(user.getUsername(), user.getPassword(), true, true, true, true, null);
 }

最佳答案

@Column(name = "lastModifiedBy")
private int lastModifiedBy;

@Column(name = "lastModifedOn")
private Date lastModifiedOn;

我的代码 lastModifedOn 中存在拼写错误,我将其更改为 lastModifiedOn,问题已永久修复。

关于java - 无法提取结果集; SQL [不适用];嵌套异常是 org.hibernate.exception.SQLGrammarException : could not extract ResultSet with oauth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60941802/

相关文章:

java - 使用纯 JPA 和 Spring 在 View 中打开 session - 而不是 Hibernate session

JPA EntityManager 为什么merge() 不管理实例?

java存储过程——Oracle中的资源文件

java - 从未使用过 Onpostexecute 方法

java - 提取 Spring Boot 用户属性

spring-boot - 连接关闭异常 : Premature end of chunk coded message body with apache hhtpclient 4. 5.5

spring-boot - 从 2.0.6 升级到 Spring Boot 2.1.2 会导致存储库错误

java - 删除 POJO 的 toString() 中的某些 JSONObject 键

java - 100% 准确的 key,value HashMap

java - Flutter - 无法将 MethodChannel 与 Firebase onBackgroundMessage 一起使用