1 | package com.wediscussmovies.project.model;
|
---|
2 |
|
---|
3 | import javax.persistence.*;
|
---|
4 | import java.sql.Date;
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | @Entity(name="persons")
|
---|
8 | public class Person {
|
---|
9 | @Id
|
---|
10 | @GeneratedValue
|
---|
11 | private int person_id;
|
---|
12 |
|
---|
13 | @Column(name="name", length=100, nullable=false, unique=false)
|
---|
14 | private String name;
|
---|
15 |
|
---|
16 | @Column(name="surname", length=100, nullable=false, unique=false)
|
---|
17 | private String surname;
|
---|
18 |
|
---|
19 | @Column(name="type", nullable = false)
|
---|
20 | private PersonType personType;
|
---|
21 |
|
---|
22 | @Column(name="date_of_birth", nullable=false)
|
---|
23 | private Date date_of_birth;
|
---|
24 |
|
---|
25 | @Column(name="image_url", length=300, nullable=false, unique=false)
|
---|
26 | private String image_url;
|
---|
27 |
|
---|
28 | @Column(name="description", length=300, nullable=false, unique=false)
|
---|
29 | private String description;
|
---|
30 |
|
---|
31 | @ManyToMany
|
---|
32 | private List<Movie> acts_in;
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | /*
|
---|
37 | create table persons(
|
---|
38 | person_id serial primary key,
|
---|
39 | name varchar(100) not null,
|
---|
40 | surname varchar(100) not null,
|
---|
41 | type char(1) not null,
|
---|
42 | date_of_birth date not null,
|
---|
43 | image_url varchar(300) not null,
|
---|
44 | description varchar(300) not null,
|
---|
45 | constraint ck_type check (type ='A' or type='D')
|
---|
46 | );
|
---|
47 | */ |
---|