Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Entity SystemRules{
- @OneToMany(mappedBy = "systemRule", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
- private List<ServiceActionMap> serviceActionMap;
- }
- Entity ServiceActionMap{
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "SYSTEM_RULE_ID")
- private SystemRules systemRule;
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "RFS_TYPE_ID", nullable = true)
- private RfsTypeMap rfsType;
- }
- Entity RfsTypeMap{
- @Id
- @Column(name="RFS_TYPE_ID" ,nullable=false)
- private BigDecimal rfsTypeId;
- @Column(name="RFS_NAME")
- private String rfsName;
- }
- CriteriaQuery<SystemRules> query = cb.createQuery(SystemRules.class);
- Root<SystemRules> root= query.from(SystemRules.class);
- root.fetch(SystemRules_.serviceActionMap).fetch(ServiceActionMap_.rfsType, JoinType.LEFT);
- cb.desc(cb.upper(systemRules.get("serviceActionMap").get("rfsType").get("rfsName").as(String.class)));
- SELECT DISTINCT s FROM SystemRules s INNER JOIN FETCH s.serviceActionMap INNER JOIN FETCH s.serviceActionMap INNER JOIN FETCH s.ruleProperty INNER JOIN FETCH s.ruleProperty where ... ORDER BY UPPER(s.serviceActionMap.rfsType.rfsName)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement