From the course: Java Persistence with JPA and Hibernate
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Native queries - JPA Tutorial
From the course: Java Persistence with JPA and Hibernate
Native queries
- [Instructor] As developers, you might sometimes feel more comfortable with native queries than JPQL queries because when working with JPQL queries, you have to always keep in mind that you are working with entity instances in the context and not with database tables directly. But on the other hand, JPQL is more close to the object-oriented way of doing things. What are native queries? Well, they are queries written directly in the language that your database understands. That is, generally, SQL. But there are certain SQL syntaxes that are DBMS specific. In any case, native queries are queries understood by the underlying database. In general, native queries should be avoided as much as possible in ORM because you will not get some of the out-of-the-box features that an ORM framework like Hibernate gives you, such as caching, checking for SQL injections, query performance, and indexing and et cetera. But there could be times when you might need to use native queries within your ORM…
Contents
-
-
-
-
-
-
-
-
-
(Locked)
JPQL queries10m 47s
-
(Locked)
Joins with JPQL9m 11s
-
(Locked)
Named queries5m 15s
-
(Locked)
Aggregate functions8m 43s
-
(Locked)
ORDER BY, GROUP BY, and HAVING9m 17s
-
(Locked)
Native queries5m 11s
-
(Locked)
Criteria queries12m 8s
-
(Locked)
Challenge: Art Class Management app, part 51m 4s
-
(Locked)
Solution: Art Class Management app, part 55m 19s
-
(Locked)
-
-