O'Reilly logo
  • Ketan Khairnar thinks this is interesting:

Because the StockItem class is the side that persists the relationship, we need to indicate what property on the StockItem class holds the relationship we’re mapping. We do this using the mappedBy attribute on the annotation, as in the following listing.

Listing 7.8. Making the Product–StockItem relationship bidirectional
import javax.persistence.*;
...

@Entity
public class Product extends Model {

  @Id
  public Lon...
            
        
			

From

Cover of Play for Java

Note

ManyToOne and OneToMany example