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