hibernate.jpa.criteria.BasicPathUsageException: Cannot join to attribute of basic type

为君一笑 提交于 2019-12-05 22:43:40

You cannot join a basic property (e.g., an attribute with a simple @Column mapping). Join is for associations:

  • one-to-one
  • one-to-many
  • many-to-one
  • many-to-many

You need to remove this line, as the taxRuleId is already fetched from the database:

Join<Tax, TaxRule> join = taxRoot.join("taxRuleId");

If you want to join the TaxRule table, you need to replace the:

@Column(name = "TAX_RULE_ID")
private Long taxRuleId;

with a many-to-one association:

@ManyToOne
@JoinColumn(name = "TAX_RULE_ID")
private TaxRule raxRule;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!