使用 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/