Mapping Relationships with Hibernate

Mapping Relationships with Hibernate

In the past we have learned about database relationships, specifically the One-to-Many as well as the Many-to-Many and One-to-One and that was all good, great and grand…

But now I want to talk about how to create those same relationships inside of Hibernate.

Specifically, I want to focus on the One-to-Many relationship in Hibernate and how we go about mapping it out in our Java objects.

But before we do, a word on unidirectional and bidirectional relationships.

Unidirectional vs Bidirectional

In Hibernate, it's possible to map all three relationships that are available in a standard database, these include:

  • One-to-One
  • One-to-Many
  • Many-to-Many

But what Hibernate also includes is the ability to make EACH of those relationships either unidirectional or bidirectional.

This means that we can have a unidirectional One-to-One and a bidirectional One-to-One mapping, as well as a unidirectional One-to-Many and a bidirectional One-to-Many, as well as a unidirectional Many-to-Many and a bidirectional Many-to-Many relationship.

That's a lot of relationships!

So what exactly are unidirectional and bidirectional relationships?

Learn more on the show notes page via http://howtoprogramwithjava.com/session53

Avsnitt(112)

EP57 - From Restaurant Manager to Software Developer

EP57 - From Restaurant Manager to Software Developer

In this episode we'll talk to Yasiin, who is a graduate from the Coders Campus Bootcamp. We dive into his story about how he started his coding journey as a Restaurant Manager, and went through two C...

27 Jan 202239min

EP56 - Fun Tricks and Analytics with IntStreams in Java

EP56 - Fun Tricks and Analytics with IntStreams in Java

In this episode we'll talk about IntStreams and why they're useful in Java. IntStreams can be used to replace a common looping mechanism as well as provide a very helpful utility for gathering analyt...

25 Jan 202229min

EP55 - How to Sort with Streams in Java

EP55 - How to Sort with Streams in Java

In this episode we'll talk about how to sort a stream of objects using the ".sorted()" function. We'll also talk about the differences between using a stream to sort vs using something like Collectio...

24 Jan 202237min

EP54 - What is the Map Operation in Java Streams?

EP54 - What is the Map Operation in Java Streams?

Big announcement: today marks the launch of our brand new "Beginners only" Coding Bootcamp. If you're a beginner to coding and have spent less than about 6 months learning to code, you're a great fit ...

26 Nov 202141min

EP53 - Intro to Streams in Java

EP53 - Intro to Streams in Java

GitHub link here: https://github.com/tp02ga/FunWithStreams In this episode we'll talk about: What are streams and why you should care about them Comparing a simple Stream example to a Looping example...

19 Nov 202143min

EP52 - Most Common Functional Interfaces in Java

EP52 - Most Common Functional Interfaces in Java

In this episode we'll talk about 7 common Functional Interfaces that Java provides to us. UnaryOperator, BinaryOperator, Supplier, Consumer, Function, Predicate and BiPredicate Interested in startin...

15 Nov 202153min

EP51 - Let's Talk Lambdas in Java

EP51 - Let's Talk Lambdas in Java

In this episode we'll talk about a super useful feature that was introduced back in Java version 8, known as Lambdas. The Lambda feature is something you didn't know you desperately wanted or needed u...

12 Nov 202157min

EP50 - #3 of 3 to Getting a Job as a Coder

EP50 - #3 of 3 to Getting a Job as a Coder

In this episode we'll talk about the 3rd key to getting a job as a coder... How do you stand out from the crowd? You put in all this effort to learn how to code. You likely have a plan, you follow a c...

6 Aug 202131min

Populärt inom Business & ekonomi

framgangspodden
badfluence
varvet
rss-jossan-nina
rss-borsens-finest
rss-svart-marknad
uppgang-och-fall
svd-tech-brief
rss-dagen-med-di
lastbilspodden
avanzapodden
fill-or-kill
rss-den-nya-ekonomin
rss-inga-dumma-fragor-om-pengar
rss-kort-lang-analyspodden-fran-di
borsmorgon
24fragor
bathina-en-podcast
ekonomiekot-extra
market-makers