@ManyToOne: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * JPA Concepts")
 
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


* [[JPA_Concepts#Relationship_Annotations|JPA Concepts]]
* [[JPA_Concepts#Relationship_Annotations|JPA Concepts]]
=Overview=
The @ManyToOne annotation in the example below indicates that the Order belongs to one and only one User, but a User can have many Orders.
<syntaxhighlight lang='java'>
@Entity
public class Order {
  ...
  @ManyToOne
  private User user;
}
</syntaxhighlight>

Latest revision as of 02:07, 18 November 2018

Internal

Overview

The @ManyToOne annotation in the example below indicates that the Order belongs to one and only one User, but a User can have many Orders.

@Entity
public class Order {
  ...
  @ManyToOne
  private User user;
}