when i try model a oneToMany self relation on RuleEntity
, hibernate generate rule_rule
table in db to handling this matter , now the question is : because i haven't this entity(rule_rule) in my domain so i can't do HQL to find relatedRules
that related to some rule :)
how can i do this?
RuleEntity
@ManyToMany(fetch = FetchType.LAZY)
private Set<RuleEntity> relatedRules;
the point is --> for some business reasons i cant't use Native Sql in this situation
tnx
ok Dudes, i find it :)
select r.ruleName from RuleEntity r JOIN r.relatedRules rr where rr.ruleName = 'myRule'
this query find RuleEntities which have relatedRule with name "myRule"