表类:
private static final long serialVersionUID = 1L;
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@JoinColumn(name = "SUBSYSTEM_ID", referencedColumnName = "ID")
@ManyToOne
private Subsystem subsystem;
@Transient
private Long subsystemId;
查询条件:
public PagedSearchResult<Tuple> findByUserId1(Long id, UserSubsystemSearchCriteria searchCriteria) {
final CriteriaBuilder criteriaBuilder = getEntityManager().getCriteriaBuilder();
final CriteriaQuery<Tuple> query = criteriaBuilder.createTupleQuery();
final Root<UserSubsystem> from = query.from(UserSubsystem.class);
query.multiselect(from.get("subsystemId"));
query.groupBy(from.get("subsystemId"));
如果我删除连接并暂时重写列定义,它就可以工作,但我需要那个连接。
1条答案
按热度按时间weylhg0b1#
不知道你想实现什么,但最简单的解决方案
和查询