Home
Videos uploaded by user “Thoughts On Java”
Should You Use JPA and Hibernate for Your next Project?
 
08:20
Do JPA and Hibernate really fit the project you’re about to start? This important question gets not asked often enough! And if you don’t think about it, in the beginning, it will be difficult to change your mind after the project started. Most often, the persistence framework gets selected based on personal preferences. And while these are often based on past experiences, it is not always the best approach. You should better check your requirements and choose a framework that fits. I prepared a few simple questions to guide you through the decision of choosing JPA or some other persistence framework. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/use-jpa-next-project/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #Tutorial
Views: 15498 Thoughts On Java
Difference between JPA, EclipseLink & Hibernate
 
10:20
Today, I will talk about the differences between JPA, Hibernate and EclipseLink. When people are new to JPA, Hibernate or EclipseLink, they are often confused about the difference between them and which one they should use in their project. If you’re one of them, don’t worry. It’s a lot easier than it seems. If you are finding me for the first time, please subscribe to this channel. I’m publishing new videos about JPA and Hibernate twice a week. 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 ➜Join the free Member Library: https://goo.gl/dtyIIC ➜ Read the accompanying post: https://www.thoughts-on-java.org/difference-jpa-hibernate-eclipselink/ ➜ Download JPA at https://jcp.org/en/jsr/detail?id=338. ➜ Getting Started With Hibernate https://www.thoughts-on-java.org/hibernate-getting-started/ ➜ JPQL Guide -https://www.thoughts-on-java.org/jpql/ ➜ Handling of database change events- https://www.eclipse.org/eclipselink/documentation/2.7/solutions/qcn.htm ➜ Composite persistence units to map entities to tables in multiple databases- https://www.eclipse.org/eclipselink/documentation/2.7/solutions/usingmultipledbs001.htm ➜ Support for multi-tenancy-https://www.eclipse.org/eclipselink/documentation/2.7/solutions/multitenancy.htm Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 10187 Thoughts On Java
Hibernate Tip: How to Map a Bidirectional Many-to-One Association
 
04:59
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk JPA and Hibernate allow you to map associations in many different ways. And today I want to show you, how to map a bidirectional many-to-one association. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/hibernate-tips-map-bidirectional-many-one-association/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 3730 Thoughts On Java
5 ways to initialize lazy associations and when to use them
 
11:16
Lazy loading of associated entities is a well-established best practice in JPA. Its main goal is to retrieve only the requested entities from the database and to load the related entities only if needed. That is a great approach if you only need the entities you selected in your query. But it creates additional work and can be the cause of performance problems if you also need some of the associated entities. In this video, I show 5 different ways to trigger the initialization of lazy associations and their specific advantages and disadvantages. Links mentioned in the video: JPA 2.1 Entity Graph – Part 1: Named entity graphs: https://goo.gl/K6sFHv JPA 2.1 Entity Graph – Part 2: Define lazy/eager loading at runtime: https://goo.gl/sSFbke Read the accompanying post: https://www.thoughts-on-java.org/5-ways-to-initialize-lazy-relations-and-when-to-use-them/ Join the free Thoughts on Java Library: https://goo.gl/OSG8rH 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
Views: 8780 Thoughts On Java
Hibernate Performance Tuning: 10 Common Hibernate Mistakes That Cripple Your Performance
 
15:09
Do you think your application could be faster if you would just solve your Hibernate problems? Then I have good news for you! I fixed performance problems in a lot of applications, and most of them were caused by the same set of mistakes. And it gets even better, most of them are easy to fix. So, it probably doesn’t take much to improve your application. Here is a list of the 10 most common mistakes that cause Hibernate performance problems and how you can fix them. How to use native queries to perform bulk updates: https://youtu.be/sbrCxgwbzD8 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/common-hibernate-mistakes-cripple-performance/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 3610 Thoughts On Java
Hibernate Tip: How to delete child entities from a many-to-one association
 
03:06
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk For some many-to-one associations, the child entity can’t exist without its parent. A typical example is the OrderItem which can’t exist without the Order. When you remove the association between the OrderItem and the Order, you need to delete that OrderItem entity as well. So, what’s the easiest way to implement that? The JPA specification provides the orphanRemoval feature for these use cases. When you activate it on the association, Hibernate removes a child entity when you remove its association to the parent entity. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-how-to-delete-child-entities/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernatTips
Views: 4624 Thoughts On Java
5 Hibernate 5 features every developer should know
 
12:54
It’s quite a while since Hibernate 5.0 came out and brought a bunch of changes. And since then the development team implemented even more features. I explained several of them here on the channel and even more on the blog. It’s about time to have a look at the most popular ones. Based on the search traffic I get from google and my personal experience, the Java 8 support is by far the most popular change. But there are also some other features which might seem small but make common development tasks a lot easier. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/5-new-features-hibernate-5-every-developer-know/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #tutorial #java
Views: 16868 Thoughts On Java
Getting Started with Flyway & Version-Based Migration
 
11:44
Today, I want to give you a quick introduction to version-based database migration with Flyway. Updating a database seems easy as long as you’re the only developer on the team and don’t have to support multiple systems. But that changes dramatically when your team implements multiple features in parallel, uses different test databases and runs the application on one or more production servers. Updating all these databases, keeping track of all executed update operations and merging the changes of your co-workers quickly becomes an issue. Getting Started with Liquibase : https://www.thoughts-on-java.org/database-migration-with-liquibase-getting-started/ Download Flyway : https://flywaydb.org 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/flyway-getting-started Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 4305 Thoughts On Java
Hibernate Tips: How to cascade a persist operation to child entities
 
03:16
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk The Hibernate Tips series provides quick answers to common questions. This time, I will show you how to cascade a persist operation to associated child entities. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/hibernate-tips-cascade-persist-operation-child-entities/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 3331 Thoughts On Java
An Introduction to JPA FetchTypes
 
07:10
The JPA FetchType defines when Hibernate gets the related entities from the database, and it is one of the crucial elements for a fast persistence tier. In general, you want to fetch the entities you use in your business tier as efficiently as possible. But that’s not that easy. You either get all relationships with one query or you fetch only the root entity and initialize the relationships as soon as you need them. I’ll explain both approaches in more detail in this video and also provide you some links to more advanced solutions that combine flexibility and efficiency. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/entity-mappings-introduction-jpa-fetchtypes/ Resources mentioned in the video: Thoughts on Java Library: http://www.thoughts-on-java.org/free-member-library-signup/ Free course "Find and Fix N+1 Select Issues": https://www.thoughts-on-java.org/free-n1_select_course Video "5 ways to initialize lazy associations and when to use them": https://www.youtube.com/watch?v=Dr5Qn6NC-3Y Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #FetchTypes #Hibernate #LazyLoading
Views: 4379 Thoughts On Java
Getting Started with Hibernate Envers
 
07:46
A lot of business applications require an audit log that documents all changes that were performed on the managed data. There are lots of different options to implement such a log. One of them is Hibernate Envers. It just takes a few annotations to document all changes in the audit tables, and Envers also provides a powerful API to extract information from your audit log. In this video, I will show you how to add Hibernate Envers to your project, activate auditing for an entity and retrieve different information from your audit log. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/hibernate-envers-getting-started/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #Envers #JPA #Tutorial
Views: 4369 Thoughts On Java
How to generate primary keys with JPA and Hibernate
 
09:08
Today, I will show you how to generate unique primary key values with JPA and Hibernate. But before we start, I want to know how you get the primary key values in your application? Do you use natural keys or UUIDs or do you generate technical IDs? Please post a comment below and tell me about it. I prefer to generate simple, numerical, technical IDs like you can see in the following code snippet instead of using natural keys which often require the combination of multiple attributes. Technical IDs are easier to manage and all involved systems, mainly the database and Hibernate, can index them very efficiently. This allows you to focus on the business logic of your application and avoids performance issues. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/jpa-generate-primary-keys/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 4678 Thoughts On Java
JPA vs Hibernate : The difference between save, persist, merge and update
 
16:06
JPA and Hibernate provide different methods to persist new and to update existing entities. You can choose between JPA’s persist and merge and Hibernate’s save and update methods. It seems like there are 2 pairs of 2 methods that do the same. You can use the methods persist and save to store a new entity and the methods merge and update to store the changes of a detached entity in the database. That’s why a lot of developers are wondering which of these methods they should use. Let’s take a closer look at the details and small differences of these methods. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/persist-save-merge-saveorupdate-whats-difference-one-use Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 26262 Thoughts On Java
Hibernate Tip: How to map native query results to a POJO
 
02:58
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk This time, I want to show you how you can tell Hibernate to map the result of a native SQL query to a POJO. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-map-native-query-results-pojo/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #POJO
Views: 4282 Thoughts On Java
How to use Hibernate's 1st level cache
 
12:00
This is a free sample lecture of my Hibernate Performance Tuning Online Training (https://www.thoughts-on-java.org/hibernate-performance-online-training/). Hibernate activates the 1st level cache by default and uses it to optimize the performance of your application if you don’t prevent it. OK, you probably wonder why you should prevent Hibernate from using the cache and optimizing the performance. That doesn’t make much sense, right? This happens by accident if you don’t know about the 1st level cache and the situations in which Hibernate can use it. But more about that in the video.
Views: 8228 Thoughts On Java
Version based database migration with Liquibase
 
10:47
Today, I want to talk about version-based database migration with Liquibase. Creating the database for your application seems to be easy as long as you don’t need to support multiple versions or work in multiple teams. You just generate an SQL script from your database model or in the worst case, export the required statements from your test database. You can then execute it manually or use JPA to do that automatically. This approach doesn’t work as soon as you need to support multiple versions of your application. And extracting the required changes from the test database becomes a huge mess when the size of your team and the number of changes increases. You can avoid some of these problems when you create the database update scripts, while working on the next release, and store them alongside your code in git or whichever version control system you use. Whenever someone gets the latest code changes, he will also get the required database changes. With the right tooling in place, you will even be able to apply these changes automatically. One tool that can help you with that is Liquibase. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/database-migration-with-liquibase-getting-started/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 5601 Thoughts On Java
Hibernate Tip: How to use a timestamp for versioning and optimistic locking
 
04:45
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk When you had to map a legacy table model in one of your projects, you probably know this situation. Instead of a numeric version column, the table model uses the timestamp of the last update. I don’t recommend using this approach because numeric versioning is much more efficient. But if you have to, you can also use a timestamp for versioning with JPA and Hibernate. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-use-timestamp-versioning-optimistic-locking/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernateTips
Views: 2089 Thoughts On Java
Hibernate Tip: How to map a bidirectional many-to-many association
 
04:51
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I want to show you how you can map a many-to-many association so that you can navigate it in both directions. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-map-bidirectional-many-many-association/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 3051 Thoughts On Java
Hibernate Tip:  How to map an entity to multiple tables
 
04:31
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I will answer a question about the mapping of entities to multiple database tables. But before we discuss it in detail, please subscribe and hit the bell icon to get a new hibernate tip video every week. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-how-to-map-an-entity-to-multiple-tables/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 5712 Thoughts On Java
Hibernate Tip: How to map a read-only database view
 
02:53
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk The Hibernate Tips series provides quick answers to common questions. This week, I show you how to map a read-only database view. 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 Join the free Member Library: http://www.thoughts-on-java.org/free-member-library Post: http://www.thoughts-on-java.org/hibernate-tips-map-view-hibernate/ Learn more: You can learn more about Hibernate's advanced mapping and query features in my Advanced Hibernate Online Training: http://bit.ly/2eojQ3w Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernateTips
Views: 4996 Thoughts On Java
Why you should avoid CascadeType.REMOVE for to-many associations and what to do instead
 
08:46
Today, I want to show you why you shouldn’t use CascadeType.REMOVE and what to do instead. The CascadeTypes REMOVE and ALL provide a comfortable option to remove an entity together with all its child entities. But that creates several issues for to-many associations, and you should only use it for to-one relationships. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/avoid-cascadetype-delete-many-assocations/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2617 Thoughts On Java
Access Strategies in JPA and Hibernate– Which is better, field or property access?
 
08:14
Today, I will talk about Access Strategies in #JPA and #Hibernate and explain if you should use field or property access? The access strategy defines how your JPA implementation, e.g., Hibernate or EclipseLink, access your entity attributes. You can choose between field-based access and property-based access. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://thoughts-on-java.org/access-strategies-in-jpa-and-hibernate/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #EclipseLink #Tutorial
Views: 1438 Thoughts On Java
6 Hibernate Best Practices for Readable and Maintainable Code
 
09:39
Implementing a readable and maintainable persistence layer with Hibernate isn’t as easy as it might seem. It often starts with just a few annotations on some Java classes and a small number of Strings containing things like JPQL or native query statements and references to attributes, queries and bind parameter names. As the project grows, you implement more entity classes. What’s even worse, you also create hundreds of Strings that you use somewhere in your business code. This quickly transforms a small and well-structured persistence layer into a huge mess. You can avoid at least some of these problems by following the best practices I show you in this video. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://thoughts-on-java.org/hibernate-best-practices-for-readable-and-maintainable-code/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #BestPractices #PerformanceTuning
Views: 999 Thoughts On Java
How to join unassociated entities with JPA and Hibernate
 
06:38
The representation of associations between entities as attributes is one of the most comfortable and popular features of JPA and Hibernate. It makes it very easy to navigate from one entity to one or more related entities in your Java code, like from a Person entity to the corresponding Address entity. You can also use the relationship attributes in JPQL queries to join entities. The trouble starts as soon as you want to join 2 entities without an association attribute. JPA and Hibernate versions before 5.1 don’t support this kind of joins, and you have to use a workaround to create an implicit cross join. I will show you this in the first part of this video and explain Hibernate’s ad-hoc join feature afterward. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/how-to-join-unrelated-entities/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Java #Hibernate #JPA #JPQL #Persistence
Views: 13401 Thoughts On Java
Best Practices for Many-To-One and One-To-Many Association Mappings
 
09:35
Today, I want to talk about best practices for many-to-one and one-to-many association mappings. When you model your database, you will most likely define several of these associations. And it’s, of course, the same when you model your entities. It’s quite easy to do that with JPA and Hibernate. You just need an attribute that represents the association and annotate it with a @ManyToOne or @OneToMany association. But as easy as it seems, there are several pitfalls that you can avoid by following a few best practices. Why you should avoid CascadeType.REMOVE for to-many associations and what to do instead:- https://youtu.be/GFy8dJNCRcY 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/best-practices-many-one-one-many-associations-mappings Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 12099 Thoughts On Java
Liquibase : How to Automatically Update a Database
 
07:09
Today, I want to show you how you can integrate Liquibase into your application so that it automatically updates your database. That is especially interesting when you build smaller applications that don’t run in a highly regulated enterprise environment. In these situations, it’s often not possible to run the update process yourself and there might be no operations team which executes the SQL scripts. So, you need to run the database update automatically when you start your application. There are several ways to do that. If you’re building a plain Java application, you can use the Liquibase API to trigger the update. And it gets even easier, if you’re using a CDI container, e.g. in a Java EE application server, or Spring. I will show you all 3 approaches in this video. The first part of this series: https://www.thoughts-on-java.org/database-migration-with-liquibase-getting-started/ 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/automatic-database-updates-integrating-liquibase/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 9263 Thoughts On Java
Hibernate Tip - How to log SQL statements and their parameters
 
02:42
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk How to log the SQL statements generated by Hibernate and their bind parameters. 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 Join the free Member Library: http://www.thoughts-on-java.org/free-member-library Hibernate Logging Guide – Use the right config for development and production: http://www.thoughts-on-java.org/hibernate-logging-guide/ Post: http://www.thoughts-on-java.org/hibernate-tips-how-to-log-sql-statements-and-their-parameters/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #SQL #HibernateTip
Views: 2330 Thoughts On Java
Hibernate Tip : How to avoid MultipleBagFetchException
 
03:03
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I will answer a question about the MultipleBagFetchException,. But before we discuss this question in detail, please subscribe and hit the bell icon to not miss any videos. I upload new videos every Tuesday and Thursday. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-how-to-avoid-hibernates-multiplebagfetchexception/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 703 Thoughts On Java
7 Tips to improve your Hibernate performance
 
23:44
Implementing the persistence tier with Hibernate is easy. You just need to add a few annotations to map a database table. Getting a good performance out of it requires more knowledge. But don’t worry, the most common reasons for performance issues are not that difficult to fix. I will show you 7 Tips that will help you to speed up your persistence tier in this video. Join the free Member Library and download a cheat sheet with the tips of this video: https://goo.gl/dfqr6n Links mentioned in the video: Mini course - Find and fix n+1 select issues: https://goo.gl/DLdZwd How to call native SQL queries with JPA and Hibernate: https://www.youtube.com/watch?v=W0-3H4_luOA Read the accompanying post: https://www.thoughts-on-java.org/tips-to-boost-your-hibernate-performance/ Learn more about Hibernate performance tuning in my online training: https://goo.gl/eZGyZK 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 #Hibernate #JPA #Performance #Tuning
Views: 15043 Thoughts On Java
Hibernate Tip: How to initialize lazy relationships within a query
 
02:50
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk The Hibernate Tips series provides quick answers to common questions. This week, I will show you how to initialize a lazy relationship within a query to avoid LazyInitializationExceptions. 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 Join the free Member Library: http://www.thoughts-on-java.org/free-member-library Post: http://www.thoughts-on-java.org/hibernate-tips-initialize-lazy-relationships-within-query/ Learn more: You can learn more about lazy fetching and how you can avoid common performance issues in my Hibernate Performance Tuning Online Training: http://bit.ly/2eMg8B3 Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernateTips #LazyInitializationExceptions
Views: 2044 Thoughts On Java
Bag vs. List vs. Set: Most Efficient Data Type  for To-Many Associations?
 
06:19
Which data type should you use to map a to-many association with Hibernate? Is it better to use a Set or a List? That’s a very common question, and most developers are surprised when they look at the documentation and find out that these are not the only options. You can also use a Bag or a Map. The mapping to a Map is a special case, and I already explained it in great details in one of my previous videos. In contrast to the other 3 options, it provides indexed based access to the associated entities. That might be beneficial for some use cases, but the creation and management of the Map also creates an overhead. It should, therefore, not be your default choice. So, let’s focus on the other 3 options. List, Set, and Bag represents simple collections of entities. List and Set should sound familiar because the java.util package contains interfaces with these names. But what is a Bag? There is no class in the java.util package with that name. How to map an association as a java.util.Map: https://youtu.be/D1xnl-yxjuA 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/association-mappings-bag-list-set/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2027 Thoughts On Java
Hibernate Tip: Get the SQL Connection used by your Hibernate Session
 
03:00
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I will show you how to get access to the SQL Connection used by your Hibernate Session. But before we start, please subscribe and hit the bell icon to get notified about new hibernate tip videos. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-get-the-sql-connection-used-by-your-hibernate-session/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 696 Thoughts On Java
Hibernate Tip: What’s the best way to persist a ZonedDateTime
 
03:22
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I will answer a question about Hibernate 5’s ZonedDateTime class. But before we dive deeper, please subscribe and hit the bell icon to get notified about new hibernate tip videos every week. During one of my recent Hibernate workshops, I got a few questions about Hibernate’s handling of ZonedDateTime objects. To sum them up, all attendees wanted to know what’s the best way to persist an attribute of type ZonedDateTime with Hibernate? 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-whats-the-best-way-to-persist-a-zoneddatetime Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 835 Thoughts On Java
Create type-safe queries with JPA’s static metamodel
 
06:27
Today I want to show you how you can use JPA’s metamodel to get rid of the String references in your persistence code. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/static-metamodel/ Resources mentioned in this video: - Hibernate Tip: How to automatically add Metamodel classes to your classpath: https://www.youtube.com/watch?v=fj7MX5oIg-E&index=8&list=PL50BZOuKafAbXxVJiD9csunZfQOJ5X7hP - Thoughts on Java Library: https://goo.gl/dtyIIC Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #Tutorial
Views: 1990 Thoughts On Java
Hibernate Tip - How to bootstrap Hibernate with Spring Boot
 
02:38
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk Today I want to show you how to bootstrap Hibernate with Spring Boot. That is extremely easy and doesn’t require a lot of explanations. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-how-to-bootstrap-hibernate-with-spring-boot Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2257 Thoughts On Java
Hibernate Tip: How to Share the Primary Key in a One-to-One Association
 
03:31
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk I got the following question on my blog, so let’s talk about it today: I need to map a one-to-one association in which the primary key value of one entity is also used as the primary key value of the other entity. How can I map that with JPA or Hibernate? JPA and Hibernate provide great support for that. You just need to add 1 annotation to your association mapping. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-same-primary-key-one-to-one-association Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 831 Thoughts On Java
How to automatically validate entity attributes with Hibernate Validator
 
05:21
Validation is an important task, but it’s most often also tedious to implement. It’s a good thing that the BeanValidation specification and Hibernate Validator as it’s reference implementation take over most of the work. They provide an easy to use, standardized way to validate object attributes and method parameters. And the best thing, they integrate with Hibernate ORM and all other JPA 2.x implementations to provide automatic validation of entity attributes. Sounds interesting? Let me give you a quick overview of what you can do. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/automatically-validate-entities-with-hibernate-validator/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #Validation #JAVA #BeanValidation #Tutorial
Views: 3980 Thoughts On Java
Getting Started with jOOQ : Building SQL Queries in Java
 
10:38
JPA and Hibernate are a great fit to implement persist and update use cases, and simple queries. But most applications need a lot more than that. You need to be able to use the full feature set of SQL to implement your queries. That’s why JPA supports native queries. But it’s not comfortable to use. You probably don’t want to provide your query as a simple String or to handle the differences between the various database dialects yourself. Other libraries are much better suited to implement complex SQL queries. One of them is jOOQ. It provides you with a Java DSL that enables you to build SQL queries in a comfortable and type-safe way. It abstracts the technical difficulties of plain JDBC and handles the subtle differences of the various SQL dialects. In this video, I will give you a basic introduction to jOOQ so that you can start using it in your application. And in my next video, I will show you how to integrate it with Hibernate. Before we get started, please make sure you subscribed to my channel and clicked the bell icon, so that you get new videos every week. Download jOOQ- https://www.jooq.org/download Configure jOOQ's code generator- https://www.jooq.org/doc/3.10/manual/code-generation/codegen-configuration/#N49C79 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/getting-started-with-jooq/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 4433 Thoughts On Java
Hibernate Tip: How to map an Enum to a database column
 
04:09
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk The Hibernate Tips series provides quick answers to common questions. This time, I will show you how to map a Java Enum to a database column. That's one of the basic JPA and Hibernate mappings and you should know the 2 standard options with their advantages and disadvantages. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/hibernate-tips-map-enum-database-column/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2876 Thoughts On Java
JPA & Hibernate: Basic result set mappings for native SQL queries
 
06:35
Quite often JPQL is not powerful enough to perform the queries you need in real world projects. In general, this is not an issue because JPA is designed as a leaky abstraction and you can use the full potential of SQL by using native queries. The only downside is, that these queries return a List of Object[] instead of the mapped entities and value objects you are used to get from JPQL queries. Each Object[] in the List contains one record returned by the database. You then need to iterate through the array, cast each Object to its specific type and map them to your domain model. This creates lots of repetitive code and type casts. It would be more comfortable, if you could tell the EntityManager to map the result of the query into entities or value objects as it is the case for JPQL statements. The good news is, JPA provides this functionality. It is called SQL result set mapping and in this video, I will show you how to use it to map your query results to managed entities. If you like this video, please give it a thumbs up and share it with your friends and co-workers. Like my channel? Subscribe! ➜ http://bit.ly/2cUsid8 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/result-set-mapping-basics/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #SQL #EntityManager #JPQL
Views: 4752 Thoughts On Java
Hibernate Tip: What's the Difference Between JOIN, LEFT JOIN and JOIN FETCH
 
06:16
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk I got the following question via email and thought that it is an interesting topic for a Hibernate Tip. So here it is: I saw JPQL queries using JOIN, LEFT JOIN and JOIN FETCH statement. What are the differences between these 3 join statements? You might know the JOIN and LEFT JOIN statements from SQL. It supports clauses with the same name and a very similar syntax. The JOIN FETCH clause is specific to JPA. Let’s take a closer look at all 3 options in this video. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-difference-join-left-join-fetch-join Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2880 Thoughts On Java
Hibernate Tip: How to map a java.util.Date
 
03:36
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk JPA and Hibernate offer a standard mapping for java.util.Date that stores it as a timestamp with nanoseconds. That’s OK as a default, but as always, it doesn’t fit all use cases. In this video, I want to show you how you can easily customize this mapping. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-map-java-util-date-database-column/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 2916 Thoughts On Java
5 Tips To Write Efficient Queries With JPA And Hibernate
 
13:07
A lot of developers seem to have a love-hate relationship with JPA and Hibernate. They love it because it makes it easy to implement most use cases and they hate it because it also makes it easy to implement very inefficient queries. In the past, I was one of these developers myself. I liked to use Hibernate, but I also struggled with slow database queries and other performance issues. That changed over the years when I spend more and more time working with and teaching about Hibernate. When you analyze enough inefficient queries, you recognize that you just have to follow a few simple recommendations to avoid most of them. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/5-tips-write-efficient-queries-jpa-hibernate/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #queries #performance tuning
Views: 2828 Thoughts On Java
How to persist LocalDate and LocalDateTime with JPA
 
06:20
Join the free Member Library to get access to free ebooks and cheat sheets about JPA and Hibernate: https://goo.gl/dfqr6n Java 8 brought lots of great features, and one of the most important and most anticipated ones was the new Date and Time API. There were lots of issues with the old API, and I won’t get into any details on why we needed a new one. I’m sure you had to struggle often enough with it yourself. The new Date and Time API is much better. It’s well designed, easy to use and (finally) immutable. The only issue that remains is that the JPA standard doesn’t support it. Well, that’s not completely correct. You can use it, but JPA will map it to a BLOB instead of a DATE or TIMESTAMP. That means the database is not aware of the date object and cannot apply any optimization for it. That’s not the way we should or want to do it. But that doesn’t mean that you can’t use the Date and Time API. You just have to decide how you want to add the support for it. You either use Hibernate 5, which provides proprietary support for the Date and Time API, or you take a few minutes to implement an AttributeConverter like I show you in this video. Read the original post: https://www.thoughts-on-java.org/persist-localdate-localdatetime-jpa/ 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 #JPA #Hibernate #Java #DateTimeAPI
Views: 6185 Thoughts On Java
Hibernate Tip: How to model associations with non primary key columns
 
03:11
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk When you’re working with legacy database, you probably had the situation that you had to map a many-to-one association that used a non-primary key column on the to-one side. You can easily map that with a @JoinColumn annotation. It allows you to reference any column that contains unique values, e.g., a natural id. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-model-association-dont-reference-primary-key-columns Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernateTips
Views: 1218 Thoughts On Java
Hibernate Tip: How to use a custom database sequence
 
03:27
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk The Hibernate Tips series provides quick answers to common questions. This week, I show you how to use a custom database sequence instead of Hibernate's default one. 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 Join the free Member Library: http://www.thoughts-on-java.org/free-member-library Post: http://www.thoughts-on-java.org/hibernate-tips-map-native-query-results-entities/ Learn more: @SqlResultSetMappings are a powerful feature which allows you to define complex mappings for native query results. You can also use it to map the query result to multiple entities (http://www.thoughts-on-java.org/result-set-mapping-complex-mappings/) or POJOs (http://www.thoughts-on-java.org/result-set-mapping-constructor-result-mappings/). Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #JPA #Hibernate #HibernateTips #DatabaseSequence
Views: 2401 Thoughts On Java
Hibernate Logging Guide: Use the right configuration for development and production
 
06:10
Choosing the right logging configuration can make the difference between finding a performance issue during development or suffering from it on production. But it can also create an overhead that slows down your application. You need to decide what you need and configure your system accordingly. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: http://www.thoughts-on-java.org/hibernate-logging-guide/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #hibernate #logging #performancetuning #JPA
Views: 2024 Thoughts On Java
Hibernate Tip: How to implement a subquery in a CriteriaQuery
 
03:56
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk One of the readers of my blog asked me the following question: In one of our use cases, we use the Criteria API to build the query dynamically. Now I need to add a subquery. Does the Criteria API support subqueries? And how can I implement them? Yes, you can use sub queries in your CriteriaQuery and I will show you how in this video. But before we jump in, please subscribe to this channel and turn on the notification so that you don’t miss any future Hibernate tips. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tip-subquery-criteriaquery Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 1925 Thoughts On Java
Using jOOQ with Hibernate: A Match Made in Heaven
 
09:46
In today's video, I will show you how to integrate Hibernate and jOOQ. In my opinion, these two are a match made in heaven. JPA and Hibernate make the implementation of simple CRUD operations extremely easy and efficient. But they lack support for complex queries. You can use JPQL and the Criteria API to define queries of mediocre complexity. If you need more, you need to write a native SQL query as a plain, un-typed String and handle the finer details of different SQL dialects yourself. jOOQ, on the other hand, provides a powerful DSL to create SQL queries in a comfortable and type-safe way. So, why not use the 2 of them together to get the best of both options? 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-jooq-a-match-made-in-heaven/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava
Views: 1508 Thoughts On Java
Hibernate Tip: How to Increase the Version of the Parent Entity When Updating a Child Entity
 
04:17
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk I got the following question from one of my readers: “I’m using optimistic locking to avoid concurrent modifications of the same entity. But Hibernate’s versioning mechanism ignores changes on the one-to-many association. How can I tell Hibernate to increase the version number when I add or remove a child entity?” The problem is that the version check defined by the JPA specification explicitly excludes relationships that are not owned by the entity. By default, the child or to-many site of the relationship owns the one-to-many association. Hibernate, therefore, doesn’t increment the version number of the of parent entity when you add or remove a child entity. 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 Join the free Member Library: https://goo.gl/dtyIIC Read the accompanying post: https://www.thoughts-on-java.org/hibernate-tips-increase-version-parent-entity-updating-child-entity/ Want to connect with me? Blog: http://www.thoughts-on-java.org/ Twitter: https://twitter.com/thjanssen123 Facebook: https://www.facebook.com/thoughtsonjava #Hibernate #JPA #HibernateTips #EntityMapping
Views: 960 Thoughts On Java