简体   繁体   中英

Is there any way we can use Left join on non related **Tables** or **Entity** using their ID only ? in Criteria Builder

Is there any way we can use Left join on non related Tables or Entity using their ID only? in Criteria Builder

class A (
   val id: UUID
   val message: String
)

class B (
  val id: UUID
  val a_id: UUID,
  val type: Boolean
)

is there any thing that can build like this using criteria builder? or any suggestion?

Select a, b from A a left join B b on a.a_id = b.id

Here is a quote from the book Java Persistence with Hibernate :

JPA and Hibernate don't support arbitrary outer joins without a mapped entity association or collection.

For your requirement, you should fall back to native SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM