Mysql bit(1)为Java Boolean?Projection type must be an interface!当Mysqlbit(1)类型映射到Java类型时, Spring Jpa Projection出现错误Boolean。
Jpa 将实体类中的布尔列转换为 Mysql 表中的位(1)列。
如果我将getIsBasicPlanInfoProjection 接口中的类型更改Integer为Boolean,则不起作用。为什么会出现错误呢?
@Query(nativeQuery=true, value="select true as isBasic from dual")
ProductOrderDto.PlanInfoProjection findPlanInfoById(Long id);
Run Code Online (Sandbox Code Playgroud)
public class ProductOrderDto {
@Getter
public static class PlanInfo {
private Boolean isBasic;
public PlanInfo(PlanInfoProjection projection) {
// this.isBasic = projection.getIsBasic(); //<-- I want to use like this.
if (projection.getIsBasic() == …Run Code Online (Sandbox Code Playgroud) I'm trying to call a @Cacheable method from within the same class.
And it didn't work. Because of:
In proxy mode (the default), only external method calls coming in through the proxy are intercepted. This means that self-invocation (in effect, a method within the target object that calls another method of the target object) does not lead to actual caching at runtime even if the invoked method is marked with @Cacheable. Consider using the aspectj mode in this case. Also, …
当我尝试更新插入测试数据(1,000 个实体)时,花了1m 5s。
\n所以我看了很多文章,然后我把处理时间减少到20秒。
\n但它对我来说仍然很慢,我相信有比我使用的方法更多的好的解决方案。有没有人有好的做法来处理这个问题?
\n我还想知道哪个部分使它变慢?
\n谢谢你!
\n该实体类是从用户手机中收集到用户步行步数的健康数据。
\nPK为userId和recorded_at(recorded_atPK来自请求数据)
@Getter\n@NoArgsConstructor\n@IdClass(StepId.class)\n@Entity\npublic class StepRecord {\n @Id\n @ManyToOne(targetEntity = User.class, fetch = FetchType.LAZY)\n @JoinColumn(name = "user_id", referencedColumnName = "id", insertable = false, updatable = false)\n private User user;\n\n @Id\n private ZonedDateTime recordedAt;\n\n @Column\n private Long count;\n\n @Builder\n public StepRecord(User user, ZonedDateTime recordedAt, Long count) {\n this.user = user;\n …Run Code Online (Sandbox Code Playgroud) spring ×3
aspectj ×1
boolean ×1
bulkinsert ×1
caching ×1
ehcache ×1
jpa ×1
mysql ×1
projection ×1