Hibernate Join two unrelated table when both has Composite Primary Key

前端 未结 5 1574
自闭症患者
自闭症患者 2020-12-31 09:21

I\'m writing java application using hibernate 5.2 but without HQL

there is two table, Transactions and ResponseCode

5条回答
  •  庸人自扰
    2020-12-31 10:24

    Change the relation from @OneToOne to @OneToMany and use fetch instead of join , it will execute only one query and hopefully it works.

     Join join =
            (Join)transaction.fetch("rc",JoinType.LEFT);
    

    and you can try it with @OneToOne too.

提交回复
热议问题