View Javadoc
1   package myorg.relex.collection;
2   
3   import java.util.ArrayList;
4   import java.util.HashSet;
5   import java.util.List;
6   import java.util.Set;
7   import javax.persistence.*;
8   
9   /**
10   * This class provides an example one/parent entity with a relationship to many child/dependent
11   * objects -- with the members in each collection based on a different hashCode/equals method.
12   */
13  @Entity
14  @Table(name="RELATIONEX_FLEET")
15  public class Fleet {
16  	@Id @GeneratedValue
17  	private int id;
18  	@Column(length=16)
19  	private String name;
20  	@OneToMany(cascade=CascadeType.PERSIST) 
21  	@JoinColumn
22  	private List<ShipByDefault> shipsListByDefault = new ArrayList<ShipByDefault>();
23  	
24  	@OneToMany(cascade=CascadeType.PERSIST)  
25  	@JoinColumn
26  	private Set<ShipByDefault> shipsSetByDefault = new HashSet<ShipByDefault>();
27  
28  	
29  	@OneToMany(cascade=CascadeType.PERSIST) 
30  	@JoinColumn
31  	private List<ShipByPK> shipsListByPK = new ArrayList<ShipByPK>();
32  	
33  	@OneToMany(cascade=CascadeType.PERSIST)  
34  	@JoinColumn
35  	private Set<ShipByPK> shipsSetByPK = new HashSet<ShipByPK>();
36  
37  
38  	@OneToMany(cascade=CascadeType.PERSIST) 
39  	@JoinColumn
40  	private List<ShipBySwitch> shipsListBySwitch = new ArrayList<ShipBySwitch>();
41  	
42  	@OneToMany(cascade=CascadeType.PERSIST)  
43  	@JoinColumn
44  	private Set<ShipBySwitch> shipsSetBySwitch = new HashSet<ShipBySwitch>();
45  
46  
47  	@OneToMany(cascade=CascadeType.PERSIST) 
48  	@JoinColumn
49  	private List<ShipByBusinessId> shipsListByBusinessId = new ArrayList<ShipByBusinessId>();
50  	
51  	@OneToMany(cascade=CascadeType.PERSIST)  
52  	@JoinColumn
53  	private Set<ShipByBusinessId> shipsSetByBusinessId = new HashSet<ShipByBusinessId>();
54  
55  	public int getId() { return id; }
56  	public void setId(int id) {
57  		this.id = id;
58  	}
59  	
60  	public String getName() { return name;}
61  	public void setName(String name) {
62  		this.name = name;
63  	}
64  	
65  	public List<ShipByDefault> getShipsListByDefault() { return shipsListByDefault; }
66  	public Set<ShipByDefault> getShipsSetByDefault() { return shipsSetByDefault; }
67  
68  	public List<ShipByPK> getShipsListByPK() { return shipsListByPK; }
69  	public Set<ShipByPK> getShipsSetByPK() { return shipsSetByPK; }
70  
71  	public List<ShipBySwitch> getShipsListBySwitch() { return shipsListBySwitch; }
72  	public Set<ShipBySwitch> getShipsSetBySwitch() { return shipsSetBySwitch; }
73  
74  	public List<ShipByBusinessId> getShipsListByBusinessId() { return shipsListByBusinessId; }
75  	public Set<ShipByBusinessId> getShipsSetByBusinessId() { return shipsSetByBusinessId; }
76  }