Skip to content

Instantly share code, notes, and snippets.

@bhdrkn
Created October 6, 2012 13:13
Show Gist options
  • Save bhdrkn/3844913 to your computer and use it in GitHub Desktop.
Save bhdrkn/3844913 to your computer and use it in GitHub Desktop.
rest-db User.java
package com.bahadirakin.model;
// Generated 06.Eki.2012 16:08:28 by Hibernate Tools 3.4.0.CR1
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
* User generated by hbm2java
*/
@Entity
@Table(name = "user")
public class User implements java.io.Serializable {
private Integer id;
private String name;
private String surname;
private String location;
private Set<Car> cars = new HashSet<Car>(0);
public User() {
}
public User(String name, String surname, String location) {
this.name = name;
this.surname = surname;
this.location = location;
}
public User(String name, String surname, String location, Set<Car> cars) {
this.name = name;
this.surname = surname;
this.location = location;
this.cars = cars;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "name", nullable = false, length = 50)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "surname", nullable = false, length = 50)
public String getSurname() {
return this.surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
@Column(name = "location", nullable = false, length = 50)
public String getLocation() {
return this.location;
}
public void setLocation(String location) {
this.location = location;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<Car> getCars() {
return this.cars;
}
public void setCars(Set<Car> cars) {
this.cars = cars;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment