Skip to content

Commit

Permalink
Use static imports and always cascade on one to many's (needed by CRUD)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed May 28, 2012
1 parent fc03299 commit 524a7d0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
@@ -1,5 +1,8 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.EAGER;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -29,7 +32,7 @@ public class Booking {
@GeneratedValue
private Long id;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "booking",cascade = CascadeType.ALL)
@OneToMany(fetch = EAGER, mappedBy = "booking", cascade = ALL)
@NotEmpty
@Valid
private Set<Allocation> allocations = new HashSet<Allocation>();
Expand Down
@@ -1,11 +1,11 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
Expand Down Expand Up @@ -53,7 +53,7 @@ public class Section implements Serializable {
@ManyToOne
private VenueLayout layout;

@OneToMany(mappedBy = "section", cascade = CascadeType.ALL)
@OneToMany(mappedBy = "section", cascade = ALL)
@NotEmpty
private Set<Row> sectionRows = new HashSet<Row>();

Expand Down
@@ -1,12 +1,13 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;
import static javax.persistence.FetchType.EAGER;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
Expand Down Expand Up @@ -37,11 +38,11 @@ public class Show implements Serializable {
@ManyToOne
private VenueLayout venueLayout;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "show", cascade = {CascadeType.ALL})
@OneToMany(fetch = EAGER, mappedBy = "show", cascade = ALL)
@NotEmpty
private Set<Performance> performances = new HashSet<Performance>();

@OneToMany(mappedBy = "show")
@OneToMany(mappedBy = "show", cascade = ALL)
@NotEmpty
private Set<PriceCategory> priceCategories = new HashSet<PriceCategory>();

Expand Down
@@ -1,5 +1,7 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -35,7 +37,7 @@ public class Venue implements Serializable {

private String description;

@OneToMany(mappedBy = "venue")
@OneToMany(mappedBy = "venue", cascade = ALL)
private Set<VenueLayout> layouts = new HashSet<VenueLayout>();

@ManyToOne
Expand Down
@@ -1,10 +1,11 @@
package org.jboss.jdf.example.ticketmonster.model;

import static javax.persistence.CascadeType.ALL;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
Expand All @@ -31,7 +32,7 @@ public class VenueLayout implements Serializable {
@ManyToOne
private Venue venue;

@OneToMany(mappedBy = "layout", cascade = CascadeType.ALL)
@OneToMany(mappedBy = "layout", cascade = ALL)
private Set<Section> sections = new HashSet<Section>();

private String name;
Expand Down

0 comments on commit 524a7d0

Please sign in to comment.