Home Hibernate JPA Transient Table
Reply: 0

Hibernate JPA Transient Table

user1152
1#
user1152 Published in May 21, 2018, 11:20 am

Is it possible to use Hibernate JPA to return a Result Set (RS) from multiple entities, but the returned RS is not a persistence entity in itself?

For Example (pseudo code):

Persistence Entity One has fields A , B , Oneflag

Persistence Entity Two has fields C , D , Twoflag

Persistence Entity Three has fields E , F , Threeflag

I am looking for something like

@Query(value ="Select A, C, E from One o, Two tw, Three th 
where o.oneFlag = tw.TwoFlag and
o.oneFlag = th.ThreeFlag", ***nativeQuery*** = true)

List<MyRsClass> findByFlag(@Param(aFlag) String aFlag);

and my non Persistence class is:

Class MyRsClass {
  String A;
  String C;
  String E
  .....
}

I certainly can accomplish this if I create MyRsClass ad a table in the DB, but I am trying to avoid this.

Any suggestion would be appreciated.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.372384 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO