2019-11-15 16:52:21 +01:00
|
|
|
package at.technikumwien.movies;
|
|
|
|
|
|
|
|
import lombok.*;
|
|
|
|
|
|
|
|
import javax.persistence.*;
|
2019-11-28 19:20:21 +01:00
|
|
|
import javax.xml.bind.annotation.XmlAttribute;
|
|
|
|
import javax.xml.bind.annotation.XmlRootElement;
|
2019-11-29 15:15:08 +01:00
|
|
|
import javax.xml.bind.annotation.XmlTransient;
|
2019-11-15 16:52:21 +01:00
|
|
|
|
|
|
|
@Data
|
|
|
|
@NoArgsConstructor
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
|
|
|
@Entity
|
|
|
|
@Table(name = "t_studios")
|
2019-11-28 19:20:21 +01:00
|
|
|
@XmlRootElement
|
2019-11-28 19:24:14 +01:00
|
|
|
@NamedQueries({
|
|
|
|
@NamedQuery(
|
|
|
|
name = "Studios.getIdByProperties",
|
2019-12-01 18:57:31 +01:00
|
|
|
query = "SELECT a FROM Studio a WHERE " +
|
2019-11-28 19:24:14 +01:00
|
|
|
"a.countrycode LIKE :countrycode AND " +
|
|
|
|
"a.name LIKE :name AND " +
|
|
|
|
"a.postcode LIKE :postcode"
|
|
|
|
),
|
|
|
|
@NamedQuery(
|
|
|
|
name = "Studios.selectAllStudios",
|
2019-12-01 18:57:31 +01:00
|
|
|
query = "SELECT n FROM Studio n"
|
2019-11-28 19:24:14 +01:00
|
|
|
)
|
|
|
|
})
|
2019-12-01 18:57:31 +01:00
|
|
|
public class Studio {
|
2019-11-15 16:52:21 +01:00
|
|
|
@Id
|
|
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
2019-12-10 15:17:37 +01:00
|
|
|
@XmlAttribute
|
2019-11-15 16:52:21 +01:00
|
|
|
private Long id;
|
|
|
|
|
|
|
|
@Column(length = 100, nullable = false)
|
2019-11-28 19:20:21 +01:00
|
|
|
@XmlAttribute
|
2019-11-15 16:52:21 +01:00
|
|
|
private String name;
|
|
|
|
|
2019-11-28 19:20:21 +01:00
|
|
|
@XmlAttribute
|
2019-11-15 16:52:21 +01:00
|
|
|
private String countrycode;
|
2019-11-28 19:20:21 +01:00
|
|
|
|
|
|
|
@XmlAttribute
|
2019-11-15 16:52:21 +01:00
|
|
|
private String postcode;
|
|
|
|
|
2019-12-01 18:57:31 +01:00
|
|
|
public Studio(String name, String countrycode, String postcode) {
|
2019-11-15 16:52:21 +01:00
|
|
|
this(null, name, countrycode, postcode);
|
|
|
|
}
|
|
|
|
}
|