简体   繁体   中英

How to insert into multiple table using JPA @Query only?

I am using JPA @Query annotation. Want to insert into two table using simple oracle query in JPA. How can I achieve this.

Don't want to use begin clause. Want single query to insert into two table.

Don't want to used one to many or any relationship due to some restriction.

It depends: if you want to have two Entity classes or one mapped from two tables. In the second case you can do it by @SecondaryTable annotation, more about it you can find on baeldung

I handle this using join and one to many relationship. Thanks all for your support.

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