/* * Hibernate OGM, Domain model persistence for NoSQL datastores * * License: GNU Lesser General Public License (LGPL), version 2.1 or later * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.ogm.backendtck.associations.manytoone; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.GenericGenerator; /** * @author Emmanuel Bernard <emmanuel@hibernate.org> */ @Entity public class Brewery { private String id; private Set<Beer> beers = new HashSet<Beer>(); @Id @GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") @Column(name = "brewery_pk") public String getId() { return id; } public void setId(String id) { this.id = id; } @OneToMany @JoinColumn(name = "brewery_id") @Cascade({ CascadeType.PERSIST, CascadeType.SAVE_UPDATE }) public Set<Beer> getBeers() { return beers; } public void setBeers(Set<Beer> beers) { this.beers = beers; } }