JPA & Hibernate: Basic Annotations You Need To Know

preview_player
Показать описание
When you start learning and using Hibernate and JPA, the number of annotations might be overwhelming. But as long as you rely on the defaults, you can implement your persistence layer using only a small subset of them.
After you have mastered the basic annotations, you can take a look at additional customization options. You can, for example, customize the join tables of many-to-many associations, use composite primary keys, or share a primary key value between 2 associated entities.
But please be careful with any mapping that tries to handle a significant difference between your table model and your domain model. Quite often, the simpler mappings are better than the complex ones. They provide better performance and are much easier to understand by all developers in your team.
In this video I will show you the key annotations you need to know to use JPA and Hibernate.

If you are new here and want to learn how to build incredible efficient persistence layers with JPA and Hibernate and all types of other Java persistence related stuff, start now by subscribing and clicking the bell, so you don't miss anything.

0:00 Introduction
1:47 Define an entity
2:03 @Entity annotation
2:20 @Table annotation
3:15 Customize your mapping
3:38 @Column annotation
4:45 @Id annotation
4:56 @GeneratedValue annotation
5:56 @Enumerated annotation
6:29 @Temporal annotation
6:57 @Lob annotation
7:45 Association mappings
8:14 @ManyToMany annotation
10:19 @ManyToOne / @OneToMany annotations
12:49 @OneToOne annotation
13:32 Conclusion

Links mentioned:
Mapping BLOBs and CLOBs with Hibernate and JPA:

Like my channel? Subscribe!

Join the free Member Library:

Want to connect with me?

#JPA #Hibernate #annotations
Рекомендации по теме
Комментарии
Автор

Thanks for the video, can I use Jackson attributes when converting JSON to an object along with the column attribute?

age.vampire
Автор

@GenerateValue, will it still work and valid if the DB table already go the entries, like if the record exist and then we bring in the generate value, will it first check what that last Id exist in the Db and give the next value or sth else?

age.vampire
Автор

hello sir myself shashank its very nice video but please upload core and advanced java, spring with jpa, hibernate also
its humble request to you please

shashanksingh
Автор

The schema in @Table annotation does not work with H2 database

dinobulja