Closed
Description
@Table("my_rule")
public class MyRule {
@Id
@Column("rule_id")
private Long ruleId;
@Column("rule_name")
private String ruleName;
@Column("rule_type")
private String ruleType;
@Column("rule_description")
private String ruleDescription;
@Transient
private Set<MyRuleCondition> conditions = new HashSet<>();
}
@Table("my_rule_condition")
public class MyRuleCondition {
@Id
@Column("condition_id")
private Long conditionId;
@Column("rule_id")
private Long ruleId;
@Column("comparison_field")
private String comparisonField;
@Column("comparison_operator")
private String comparisonOperator;
@Column("comparison_value")
private String comparisonValue;
}
@Query(value = "select r.rule_id, r.rule_name, r.rule_type, r.rule_description, "
+ "c.comparison_field, c.comparison_operator, c.comparison_value "
+ "from my_rule r left join my_rule_condition c on r.rule_id = c.rule_id")
List<MyRule> customFind();
When I call the customFind
method, the rule object duplicated with conditions empty
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
schauder commentedon May 31, 2024
Either only select the aggregate root or provide a custom
ResultSetExtractor
.This issue tracker is for bug reports and feature/improvement requests.
This question is more of a usage questions. Those should be asked at Stackoverflow and be tagged with
spring-data-jdbc
.By using Stackoverflow, the community can assist and the questions and their answers can more easily be found using the search engine of your choice.