java - ORA-00932 : inconsistent datatypes: expected - got clob hibernate/springboot

标签 java oracle hibernate spring-boot blob

使用 hibernate w/oracle 来提取记分牌数据,并将头像图像存储为 base64 LOB。我做了一些研究,似乎所有其他类似的帖子都是人们试图通过不同或将其放在 where 子句中与 CLOB 数据进行比较。我还读到oracle does not support CLOB inside a temp table(view),如果是这种情况,我还如何从数据库获取数据。仅供引用,代码在内存数据库的 H2 中运行。

查询抛出错误:

select distinct score.userId as userId, sum(score.totalScore) as totalScore, 
    sum(score.timeTaken) as timeTaken, user.image as image
from Score score, User user
where score.userId = user.userId
group by score.userId order by totalScore desc, timeTaken asc

实体:

用户:

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "id_Sequence2")
@SequenceGenerator(name = "id_Sequence2", sequenceName = "ID_SEQ2")
@Column(name = "id", updatable = false, nullable = false)
int id;
int userId;
@Lob
String image;
Date createdDate;
Date lastLoggedIn;

分数:

@Id
@Column(name = "quizID", updatable = false, nullable = false)
int quizId;
@Id
@Column(name = "userID", updatable = false, nullable = false)
int userId;
double totalScore;
@OneToMany(targetEntity=UserQuizRecord.class, fetch=FetchType.EAGER, cascade = { CascadeType.ALL })
List<UserQuizRecord> userQuizRecords;
int timeTaken;
int correctAns;
Date takenDate;

最佳答案

检查此链接。

https://forum.hibernate.org/viewtopic.php?f=1&t=998284

据此,DISTINCT 不能与 CLOB 数据类型(即 image)一起使用。请检查这是否可以解决您的问题。

关于java - ORA-00932 : inconsistent datatypes: expected - got clob hibernate/springboot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53691369/

相关文章:

sql - PL/SQL 在 LOOPING 中使用获取数据

java - Hibernate 生成不明确的 SQL 查询

java - 从Oracle存储过程中的SYS_REFCURSOR读取数据并在java中重用它

java - 为什么我的 mac 不显示 java 版本?

tomcat - debian squeeze 上的 sun java6 内存不足异常,而不是 openjdk

java - 无法使用 pdfbox 打印任何内容

java - Recyclerview 构造函数不保存参数

java - Visual Studio 2013 企业版 : Oracle Java SDK A more recent version of this software is required

oracle - 在 tcsh 中创建 oracle 数据库链接时 () 放置不当

hibernate - 将 H2 数据转换为 PostgreSQL