Created
June 1, 2010 16:49
-
-
Save dbonillaf/421145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.six.model.entity; | |
import java.io.Serializable; | |
import javax.persistence.*; | |
import static javax.persistence.CascadeType.*; | |
import java.util.Collection; | |
import java.util.ArrayList; | |
@Entity | |
@NamedQueries({ | |
@NamedQuery(name = "Customer.findById", query = "SELECT u FROM Customer u WHERE u.id = :id")}) | |
public class Customer implements Serializable { | |
private int id; | |
private String name; | |
private Collection<Order> orders = new ArrayList<Order>(); | |
private int version; | |
@Id | |
public int getId() { | |
return id; | |
} | |
public void setId(int id) { | |
this.id = id; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
@OneToMany(cascade=ALL, mappedBy="customer") | |
public Collection<Order> getOrders() { | |
return orders; | |
} | |
public void setOrders(Collection<Order> newValue) { | |
this.orders = newValue; | |
} | |
@Version | |
public int getVersion() { | |
return version; | |
} | |
public void setVersion(int version) { | |
this.version = version; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment