How to call native SQL queries with JPA and Hibernate
Join the free Member Library and download your ebook about native queries: https://goo.gl/dfqr6n More information about SqlResultSetMappings: https://goo.gl/onPhOy JPQL is the most common way to query data from a database with JPA and Hibernate. But it supports only a small subset of the SQL standard, and it also provides no support for database specific features. So what shall you do, if you need to use a database-specific query feature or your DBA gives you a highly optimized query that you can’t transform into JPQL? Just ignore it and do all the work in the Java code? Or get a JDBC connection to execute the query? Of course not! JPA has its own query language, but it also supports native SQL. You can create these queries in a very similar way as JPQL queries, and they can even return managed entities if you want. Read the accompanying post: https://thoughts-on-java.org/jpa-native-queries/ If you like this video, please give me your thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Join the free Member Library and download your ebook about native queries: https://goo.gl/dfqr6n More information about SqlResultSetMappings: https://goo.gl/onPhOy JPQL is the most common way to query data from a database with JPA and Hibernate. But it supports only a small subset of the SQL standard, and it also provides no support for database specific features. So what shall you do, if you need to use a database-specific query feature or your DBA gives you a highly optimized query that you can’t transform into JPQL? Just ignore it and do all the work in the Java code? Or get a JDBC connection to execute the query? Of course not! JPA has its own query language, but it also supports native SQL. You can create these queries in a very similar way as JPQL queries, and they can even return managed entities if you want. Read the accompanying post: https://thoughts-on-java.org/jpa-native-queries/ If you like this video, please give me your thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava