We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi there, I wanted to know if there was a typo in lesson about One-to-one relationships.
I'm talking about mappedBy="customerId". Isn't it supposed to be simply "customer" in this case?
mappedBy="customerId"
"customer"
@Entity public class Customer { // ... @OneToOne(mappedBy="customerId") private Address address; // ... } @Entity public class Address { @Id private Long id; private String description; @OneToOne private Customer customer; // ... }
UPD: Same in Many-to-many relationships:
@Entity public class Order { @Id private Long id; private Date date; Decimal amount; // btw, BigDecimal? @ManyToMany @JoinTable(name="ORDER_ITEM", joinColumns=@JoinColumn(name="ORDER_ID"), inverseJoinColumns=@JoinColumn(name="ITEM_ID")) private Set<Item> items = new HashSet<>(); // ... } @Entity public class Item { @Id @GeneratedValue private Long id; private String name; @ManyToMany(mappedBy = "orders") // should be "items"? private Set<Order> orders = new HashSet<>(); // ... }
The text was updated successfully, but these errors were encountered:
Yeah, I noticed this as well
Sorry, something went wrong.
No branches or pull requests
Hi there, I wanted to know if there was a typo in lesson about One-to-one relationships.
I'm talking about
mappedBy="customerId"
. Isn't it supposed to be simply"customer"
in this case?UPD:
Same in Many-to-many relationships:
The text was updated successfully, but these errors were encountered: