main
Last change
on this file since 7a0bf79 was 7a0bf79, checked in by Petar Partaloski <ppartaloski@…>, 2 years ago |
Early implementations, MovieController CRUD implementation included
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6e7b472] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
[7a0bf79] | 3 | import lombok.Data;
|
---|
| 4 |
|
---|
[6e7b472] | 5 | import javax.persistence.*;
|
---|
| 6 | import java.sql.Date;
|
---|
| 7 |
|
---|
[7a0bf79] | 8 | @Data
|
---|
[6e7b472] | 9 | @Entity(name="replies")
|
---|
| 10 | public class Reply {
|
---|
| 11 | @Id
|
---|
| 12 | @GeneratedValue
|
---|
| 13 | @Column(name = "reply_id")
|
---|
| 14 | private int reply_id;
|
---|
| 15 |
|
---|
| 16 | @ManyToOne
|
---|
| 17 | @Column(name = "discussion_id")
|
---|
| 18 | private Discussion discussion;
|
---|
| 19 |
|
---|
| 20 | @ManyToOne
|
---|
| 21 | @Column(name = "user_id")
|
---|
| 22 | private User user;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "date", nullable = false)
|
---|
| 25 | private Date date;
|
---|
| 26 |
|
---|
| 27 | @Column(name= "text", length = 1000, nullable = false)
|
---|
| 28 | private String text;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | /*
|
---|
| 33 |
|
---|
| 34 | create table replies(
|
---|
| 35 | discussion_id integer,
|
---|
| 36 | reply_id serial,
|
---|
| 37 | text varchar(1000) not null,
|
---|
| 38 | date date not null,
|
---|
| 39 | user_id integer not null,
|
---|
| 40 | constraint pk_replies primary key(discussion_id,reply_id),
|
---|
| 41 | constraint fk_user_create_reply foreign key (user_id) references users(user_id)
|
---|
| 42 | on delete cascade on update cascade,
|
---|
| 43 | constraint fk_reply_discussion foreign key (discussion_id) references discussions(discussion_id)
|
---|
| 44 | on delete cascade on update cascade
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | );
|
---|
| 48 | */ |
---|
Note:
See
TracBrowser
for help on using the repository browser.