package at.technikumwien.movies; import lombok.*; import javax.persistence.*; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import java.time.LocalDate; @Data @NoArgsConstructor @AllArgsConstructor @Entity @Table(name = "t_actors") @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 public class Actors { @XmlAttribute(name = "id") @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; @Column(nullable = false) private LocalDate birthdate; public Actors(String firstname, String lastname, Sex sex, LocalDate birthdate) { this(null, firstname, lastname, sex, birthdate); } }