@Spring在春季数据不起作用

编程入门 行业动态 更新时间:2024-10-11 05:30:50
本文介绍了@Spring在春季数据不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有结算实体

@Entity @Table(name = "settlement") public class Settlement { @ManyToOne @JoinColumn(name = "subscription_x_product_id") private ProductSubscription productSubscription;

与 ProductSubscription entity

@Entity @Table(name = "subscriptionproduct") public class ProductSubscription { @ManyToOne @JoinColumn(name = "product_id") private Product product;

与产品实体

@Entity public class Product { @Transient private String enabled;

在产品实体中,我有字段已启用,其中注释了 @ org.springframework.data.annotation.Transient 。 也有我的存储库

in Product entity i have field enabled which annotated with @org.springframework.data.annotation.Transient. also I have Repository

public interface SettlementRepository extends JpaRepository<Settlement, Integer>

当我调用 SettlementRepository.findAll(); 它给出异常引起:com.microsoft.sqlserver.jdbc.SQLServerException:无效的列名'enabled'。

如何忽略从数据库加载的启用的字段?

How can I ignore the enabled field from being loaded from the DB ?

推荐答案

我找到了解决方案,问题出现在Annotation @ org.springframework.data.annotation.Transient 中,一旦我改为 @ javax.persistence.Transient 它工作得很好。

I found the solution, the problem was in Annotation @org.springframework.data.annotation.Transient once I changed to @javax.persistence.Transient it worked fine.

更多推荐

@Spring在春季数据不起作用

本文发布于:2023-10-26 07:03:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529417.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:春季   不起作用   数据   Spring

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!