java – Spring数据中的@Transient不起作用

weixin_38093608 2019-09-12 12:42:41
我有结算实体 @Entity @Table(name = "settlement") public class Settlement { @ManyToOne @JoinColumn(name = "subscription_x_product_id") private ProductSubscription productSubscription; 与ProductSubscription实体相关 @Entity @Table(name = "subscriptionproduct") public class ProductSubscription { @ManyToOne @JoinColumn(name = "product_id") private Product product; 与Product实体相关 @Entity public class Product { @Transient private String enabled; 在产品实体中,我已启用了使用@ org.springframework.data.annotation.Transient注释的字段.我也有存储库 public interface SettlementRepository extends JpaRepository<Settlement, Integer> 当我调用SettlementRepository.findAll();它给出异常引起:com.microsoft.sqlserver.jdbc.SQLServerException:无效的列名’enabled’. 如何忽略从DB加载的启用字段?
...全文
794 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38099915 2019-09-12
  • 打赏
  • 举报
回复
我找到了解决方案,问题出现在Annotation @ org.springframework.data.annotation.Transient中,一旦我改为@javax.persistence.Transient就行了.

433

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧