47 lines
1.1 KiB
Java
Raw Normal View History

2019-11-15 16:52:21 +01:00
package at.technikumwien.movies;
import lombok.*;
import javax.persistence.*;
2019-11-26 15:27:02 +01:00
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
2019-11-15 16:52:21 +01:00
import java.time.LocalDate;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "t_actors")
2019-11-26 15:27:02 +01:00
@NamedQuery(
name = "Actors.getIdByProperties",
query = "SELECT a.id FROM Actors a WHERE " +
"a.firstname LIKE :firstname AND " +
"a.lastname LIKE :lastname AND " +
"a.sex = :sex AND " +
"a.birthdate = :birthdate"
)
@XmlRootElement
2019-11-15 16:52:21 +01:00
public class Actors {
2019-11-26 15:27:02 +01:00
@XmlAttribute(name = "id")
2019-11-15 16:52:21 +01:00
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 100, nullable = false)
private String firstname;
@Column(length = 100, nullable = false)
private String lastname;
@Column(nullable = false)
private Sex sex;
2019-11-26 15:27:02 +01:00
@Column(nullable = false)
2019-11-15 16:52:21 +01:00
private LocalDate birthdate;
public Actors(String firstname, String lastname, Sex sex, LocalDate birthdate) {
this(null, firstname, lastname, sex, birthdate);
}
}