Listing 16-3. The Contact Entity Class
package com.apress.prospring3.ch16.domain;
import static javax.persistence.GenerationType.IDENTITY;
import java.io.Serializable;
import javax.persistence.*;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
@Entity
@Table(name = "contact")
public class Contact implements Serializable {
private
Long id;
private
int version;
private
String firstName;
private
String lastName;
private
DateTime birthDate;
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID")
public Long getId() {
return id;
}
@Version
@Column(name = "VERSION")
public int getVersion() {
return version;
}
@Column(name = "FIRST_NAME")
public String getFirstName() {
return firstName;
}
@Column(name = "LAST_NAME")
public String getLastName() {
return lastName;
}
@Column(name = "BIRTH_DATE")
@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
public DateTime getBirthDate() {
return birthDate;
}
// Setter methods omitted
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home