Index: src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java
===================================================================
--- src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/WeDiscussMoviesApplication.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,6 +1,9 @@
 package com.wediscussmovies.project;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.jdbc.core.JdbcTemplate;
 
 @SpringBootApplication
@@ -8,6 +11,8 @@
 
     public static void main(String[] args) {
+
         SpringApplication.run(WeDiscussMoviesApplication.class, args);
     }
 
+
 }
Index: src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java
===================================================================
--- src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/exception/MovieIdNotFoundException.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -2,5 +2,5 @@
 
 public class MovieIdNotFoundException extends RuntimeException{
-    public MovieIdNotFoundException(Long id){
+    public MovieIdNotFoundException(Integer id){
         super("Movie with that id=" + id + " does not exist!");
     }
Index: src/main/java/com/wediscussmovies/project/model/Discussion.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Discussion.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,66 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import com.wediscussmovies.project.model.enumerations.DiscussionType;
-import lombok.Data;
-
-import javax.persistence.*;
-import java.sql.Date;
-import java.util.Collection;
-import java.util.List;
-import java.util.Objects;
-
-@Data
-@Entity
-@Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-public class Discussion {
-
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "discussion_id")
-    private Long id;
-
-    @Enumerated
-    private DiscussionType type;
-
-    private String text;
-
-    private String title;
-
-    private Date date;
-
-
-
-
-
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false)
-    private User user;
-
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id")
-    private Movie movie;
-
-    @ManyToOne
-    @JoinColumn(name = "person_id", referencedColumnName = "person_id")
-    private Person person;
-
-
-
-
-
-
-    public Discussion(DiscussionType type, String text, String title, Date date, User user, Movie movie, Person person, List<Reply> replies) {
-        this.type = type;
-        this.text = text;
-        this.title = title;
-        this.date = date;
-        this.user = user;
-        this.movie = movie;
-        this.person = person;
-    }
-
-    public Discussion() {
-    }
-
-
-}
Index: src/main/java/com/wediscussmovies/project/model/DiscussionType.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/DiscussionType.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,5 +1,0 @@
-package com.wediscussmovies.project.model;
-
-public enum DiscussionType {
-    M,P
-}
Index: src/main/java/com/wediscussmovies/project/model/Genre.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Genre.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,29 +1,0 @@
-package com.wediscussmovies.project.model;
-
-
-import javax.persistence.*;
-import java.util.Collection;
-import lombok.Data;
-
-
-@Entity
-@Table(name = "genres", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@Data
-public class Genre {
-
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "genre_id")
-    private Long id;
-
-    @Column(name = "genre_type")
-    private String genre;
-
-    public Genre(String genre) {
-        this.genre = genre;
-    }
-
-    public Genre() {
-    }
-
-}
Index: src/main/java/com/wediscussmovies/project/model/Movie.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Movie.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,98 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import lombok.Data;
-
-import javax.persistence.*;
-import java.sql.Date;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-
-
-@Entity
-@Table(name = "movies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@Data
-public class Movie {
-
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "movie_id")
-    private Long id;
-
-    private String title;
-
-    private String description;
-
-    @Column(name = "image_url")
-    private String imageUrl;
-
-
-    @Column(name = "airing_date")
-    private Date aringDate;
-
-    @Column(name = "imdb_rating")
-    private Double imbdRating;
-
-    @ManyToMany
-    private List<Genre> genres;
-
-    @ManyToMany
-    private List<Person> likes;
-
-    @ManyToMany
-    private List<Person> actors;
-
-
-
-
-    @ManyToOne
-    @JoinColumn(name = "director_id")
-    private Person director;
-
-
-
-
-
-
-    public boolean isFromGenre(Genre genre){
-
-     return    genres
-                .stream()
-                .anyMatch(g -> Objects.equals(g.getId(), genre.getId()));
-
-    }
-    public boolean hasActor(Person p){
-        return
-                actors
-                        .stream()
-                        .anyMatch(a -> Objects.equals(a.getPersonId(), p.getPersonId()));
-
-
-    }
-
-    public boolean isDirectedBy(Person p){
-        return Objects.equals(director.getPersonId(), p.getPersonId());
-    }
-
-    public static Comparator<Movie> comparatorTitle = Comparator.comparing(Movie::getTitle);
-
-
-    public Movie( String title, String description, String imageUrl, Date aringDate, Double imbdRating,Person director, List<Person> actors, List<Genre> genres) {
-
-        this.title = title;
-        this.description = description;
-        this.imageUrl = imageUrl;
-        this.aringDate = aringDate;
-        this.imbdRating = imbdRating;
-        this.genres = genres;
-        this.likes = likes;
-        this.actors = actors;
-        this.director = director;
-    }
-
-    public Movie() {
-    }
-
-
-}
Index: src/main/java/com/wediscussmovies/project/model/MovieRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,40 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "movie_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(MovieRatesPK.class)
-public class MovieRates {
-
-    @Id
-    @Column(name = "movie_id")
-    private Long movieId;
-
-    @Id
-    @Column(name = "user_id")
-    private Long userId;
-
-    private String reason;
-
-    @Column(name = "stars_rated")
-    private int stars;
-
-    @ManyToOne
-    @JoinColumn(name = "movie_id", referencedColumnName = "movie_id", nullable = false, insertable = false, updatable = false)
-    private Movie movie;
-
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false, insertable = false, updatable = false)
-    private User user;
-
-    public MovieRates(Long movieId, Long userId, String reason, int starsRated) {
-        this.movieId = movieId;
-        this.userId = userId;
-        this.reason = reason;
-        this.stars = starsRated;
-    }
-
-    public MovieRates() {
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/MovieRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/MovieRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class MovieRatesPK implements Serializable {
-
-    @Id
-    @Column(name = "movie_id")
-    private Long movieId;
-
-    @Id
-    @Column(name = "user_id")
-    private Long userId;
-
-}
Index: src/main/java/com/wediscussmovies/project/model/Person.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Person.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,48 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import com.wediscussmovies.project.model.enumerations.PersonType;
-import lombok.Data;
-
-import javax.persistence.*;
-import java.sql.Date;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@Data
-public class Person {
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "person_id")
-    private Long personId;
-
-    private String name;
-
-    private String surname;
-
-    @Enumerated
-    private PersonType type;
-
-    @Column(name = "date_of_birth")
-    private Date birthDate;
-
-    @Column(name = "image_url")
-    private String imageUrl;
-
-    private String description;
-
-
-
-    public Person() {
-    }
-
-    public Person(String name, String surname, PersonType type, Date date_of_birth, String image_url, String description) {
-        this.name = name;
-        this.surname = surname;
-        this.type = type;
-        this.birthDate = date_of_birth;
-        this.imageUrl = image_url;
-        this.description = description;
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/PersonRates.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRates.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,41 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import lombok.Data;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "person_rates", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(PersonRatesPK.class)
-@Data
-public class PersonRates {
-    @Id
-    @Column(name = "person_id")
-    private Long personId;
-
-    @Id
-    @Column(name = "user_id")
-    private Long userId;
-
-    private String reason;
-
-    @Column(name = "stars_rated")
-    private int stars;
-
-    @ManyToOne
-    @JoinColumn(name = "person_id", referencedColumnName = "person_id", nullable = false,insertable = false, updatable = false)
-    private Person person;
-    @ManyToOne
-    @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
-    private User user;
-
-    public PersonRates(Long person_id, Long user_id, String reason, int stars_rated) {
-        this.personId = person_id;
-        this.userId = user_id;
-        this.reason = reason;
-        this.stars = stars_rated;
-    }
-
-    public PersonRates() {
-    }
-}
Index: src/main/java/com/wediscussmovies/project/model/PersonRatesPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/PersonRatesPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class PersonRatesPK implements Serializable {
-
-    @Id
-    @Column(name = "person_id")
-    private Long personId;
-    @Id
-    @Column(name = "user_id")
-    private Long userId;
-
-
-}
Index: src/main/java/com/wediscussmovies/project/model/RepliesEntityPK.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/RepliesEntityPK.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,20 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import java.io.Serializable;
-
-public class RepliesEntityPK implements Serializable {
-    @Id
-    @Column(name = "discussion_id")
-    private Long discussionId;
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "reply_id")
-    private Long replyId;
-
-
-
-}
Index: src/main/java/com/wediscussmovies/project/model/Reply.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/Reply.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,51 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import lombok.Data;
-
-import javax.persistence.*;
-import java.sql.Date;
-import java.util.Optional;
-
-@Entity
-@Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-@IdClass(RepliesEntityPK.class)
-@Data
-public class Reply {
-    @Id
-    @Column(name = "discussion_id")
-    private Long discussionId;
-
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "reply_id")
-    private Long replyId;
-
-    private String text;
-
-    private Date date;
-
-    @ManyToOne
-    @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false)
-    private Discussion discussion;
-
-    @ManyToOne
-    @JoinColumn(name = "user_id")
-    private User user;
-
-
-
-
-    public Reply(Discussion discussion, User user, Date date, String text) {
-        this.discussion = discussion;
-        this.user = user;
-        this.date = date;
-        this.text = text;
-
-    }
-
-    public Reply() {
-
-    }
-
-
-}
Index: src/main/java/com/wediscussmovies/project/model/User.java
===================================================================
--- src/main/java/com/wediscussmovies/project/model/User.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,41 +1,0 @@
-package com.wediscussmovies.project.model;
-
-import javax.persistence.*;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name = "users", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
-public class User {
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Id
-    @Column(name = "user_id")
-    private Long userId;
-
-    private String username;
-
-    private String name;
-
-    private String surname;
-
-    private String email;
-
-    private String password;
-
-    @ManyToMany
-    private List<Movie> movies;
-
-
-
-
-    public User(String username, String name, String surname, String email, String password) {
-        this.username = username;
-        this.name = name;
-        this.surname = surname;
-        this.email = email;
-        this.password = password;
-    }
-
-    public User() {
-    }
-}
Index: src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/DiscussionRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,9 +1,9 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.Discussion;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import com.wediscussmovies.project.model.*;
 
 @Repository
Index: src/main/java/com/wediscussmovies/project/repository/GenreRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/GenreRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.*;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
@@ -9,4 +9,4 @@
 @Repository
 public interface GenreRepository extends JpaRepository<Genre, Integer> {
-    public List<Genre> findAllByGenre(String genre_type);
+    public List<Genre> findAllByGenreType(String genre);
 }
Index: src/main/java/com/wediscussmovies/project/repository/MovieRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/MovieRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,9 +1,9 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.Movie;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import com.wediscussmovies.project.model.*;
 
 @Repository
Index: src/main/java/com/wediscussmovies/project/repository/PersonRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/PersonRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,8 +1,7 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.model.enumerations.PersonType;
 import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
@@ -12,7 +11,7 @@
 @Repository
 public interface PersonRepository extends JpaRepository<Person, Integer> {
-    public List<Person> findAllByPersonType(PersonType type);
-    public List<Person> findAllByPersonTypeAndNameLike(PersonType type, String name);
-    public List<Person> findAllByPersonTypeAndSurnameLike(PersonType type, String surname);
-    public Optional<Person> findPersonByPerson_idAndPersonType(Integer id, PersonType type);
+    public List<Person> findAllByType(Character type);
+    public List<Person> findAllByTypeAndNameLike(Character type, String name);
+    public List<Person> findAllByTypeAndSurnameLike(Character type, String surname);
+    public Optional<Person> findPersonByPersonIdAndType(Integer id, Character type);
 }
Index: src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/ReplyRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,7 +1,8 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.Reply;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
+import com.wediscussmovies.project.model.*;
+
 
 @Repository
Index: src/main/java/com/wediscussmovies/project/repository/UserRepository.java
===================================================================
--- src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/repository/UserRepository.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,9 +1,8 @@
 package com.wediscussmovies.project.repository;
 
-import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.*;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
-import java.util.EnumMap;
 import java.util.Optional;
 
Index: src/main/java/com/wediscussmovies/project/service/DiscussionService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/DiscussionService.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service;
 
-import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.*;
 
 import java.util.List;
Index: src/main/java/com/wediscussmovies/project/service/GenreService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/GenreService.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service;
 
-import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.*;
 import org.springframework.stereotype.Service;
 
Index: src/main/java/com/wediscussmovies/project/service/MovieService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/MovieService.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service;
 
-import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.*;
 
 import java.util.List;
@@ -9,6 +9,6 @@
     public List<Movie> listAll();
     public List<Movie> searchByTitle(String title);
-    public Optional<Movie> findById(Long id);
+    public Optional<Movie> findById(Integer id);
     public Movie save(Movie movie);
-    public void deleteById(Long id);
+    public void deleteById(Integer id);
 }
Index: src/main/java/com/wediscussmovies/project/service/PersonService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/PersonService.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service;
 
-import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.*;
 
 import java.util.List;
Index: src/main/java/com/wediscussmovies/project/service/UserService.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/UserService.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service;
 
-import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.*;
 
 import javax.servlet.http.HttpServletRequest;
Index: src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/DiscussionServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.Discussion;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.repository.DiscussionRepository;
 import com.wediscussmovies.project.service.DiscussionService;
Index: src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/GenreServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.Genre;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.repository.GenreRepository;
 import com.wediscussmovies.project.service.GenreService;
@@ -24,10 +24,10 @@
     @Override
     public List<Genre> findAllByType(String genre) {
-        return genreRepository.findAllByGenre(genre);
+        return genreRepository.findAllByGenreType(genre);
     }
 
     @Override
     public Genre save(String genreName) {
-        Genre genre = new Genre(genreName);
+       Genre genre = new Genre(genreName);
         return genreRepository.save(genre);
     }
Index: src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/MovieServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.Movie;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.repository.MovieRepository;
 import com.wediscussmovies.project.service.MovieService;
@@ -23,5 +23,5 @@
 
     @Override
-    public Optional<Movie> findById(Long id) {
+    public Optional<Movie> findById(Integer id) {
         return movieRepository.findById(1);
     }
@@ -33,6 +33,6 @@
 
     @Override
-    public void deleteById(Long id) {
-        movieRepository.deleteById(0);
+    public void deleteById(Integer id) {
+        movieRepository.deleteById(id);
     }
 
Index: src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/PersonServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.model.enumerations.PersonType;
 import com.wediscussmovies.project.repository.PersonRepository;
@@ -21,10 +21,10 @@
     @Override
     public List<Person> findAllDirectors() {
-        return personRepository.findAllByPersonType(PersonType.D);
+        return personRepository.findAllByType('D');
     }
 
     @Override
     public Optional<Person> findActorById(Integer id) {
-        return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.A);
+        return personRepository.findPersonByPersonIdAndType(id, 'A');
     }
 
@@ -36,10 +36,10 @@
     @Override
     public Optional<Person> findDirectorById(Integer id) {
-        return personRepository.findPersonByPerson_idAndPersonType(id, PersonType.D);
+        return personRepository.findPersonByPersonIdAndType(id, 'D');
     }
 
     @Override
     public List<Person> findAllActors() {
-        return personRepository.findAllByPersonType(PersonType.A);
+        return personRepository.findAllByType('A');
     }
 
@@ -54,20 +54,20 @@
     @Override
     public List<Person> findActorsByNameLike(String name) {
-        return personRepository.findAllByPersonTypeAndNameLike(PersonType.A, name);
+        return personRepository.findAllByTypeAndNameLike('A', name);
     }
 
     @Override
     public List<Person> findActorsBySurnameLike(String surname) {
-        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.A, surname);
+        return personRepository.findAllByTypeAndSurnameLike('A', surname);
     }
 
     @Override
     public List<Person> findDirectorsByNameLike(String name) {
-        return personRepository.findAllByPersonTypeAndNameLike(PersonType.D, name);
+        return personRepository.findAllByTypeAndNameLike('D', name);
     }
 
     @Override
     public List<Person> findDirectorsBySurnameLike(String surname) {
-        return personRepository.findAllByPersonTypeAndSurnameLike(PersonType.D, surname);
+        return personRepository.findAllByTypeAndSurnameLike('D', surname);
     }
 }
Index: src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/ReplyServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.repository.ReplyRepository;
 import com.wediscussmovies.project.service.ReplyService;
Index: src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java
===================================================================
--- src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/service/impl/UserServiceImpl.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,6 +1,5 @@
 package com.wediscussmovies.project.service.impl;
 
-import com.wediscussmovies.project.model.PasswordEncoder;
-import com.wediscussmovies.project.model.User;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.model.exception.PasswordsDontMatchException;
 import com.wediscussmovies.project.model.exception.UserWithEmailAlreadyExists;
@@ -8,9 +7,7 @@
 import com.wediscussmovies.project.repository.UserRepository;
 import com.wediscussmovies.project.service.UserService;
-import org.springframework.http.HttpRequest;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
-import java.security.NoSuchAlgorithmException;
 import java.util.Optional;
 
Index: src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/DiscussionsController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -2,5 +2,5 @@
 
 import com.wediscussmovies.project.model.*;
-import com.wediscussmovies.project.model.enumerations.DiscussionType;
+
 import com.wediscussmovies.project.service.DiscussionService;
 import com.wediscussmovies.project.service.MovieService;
@@ -14,5 +14,4 @@
 import java.sql.Date;
 import java.time.LocalDate;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -80,6 +79,6 @@
         if(discussion.isEmpty())
             return "redirect:/discussions";
-        Reply reply = new Reply(discussion.get(), user, date, text);
-        replyService.save(reply);
+        //Reply reply = new Reply(discussion.get(), user, date, text);
+       // replyService.save(reply);
         return "redirect:/discussions/"+id;
     }
@@ -103,11 +102,11 @@
             return "redirect:/login";
         }
-        Long movie_id = (Long) request.getSession().getAttribute("movieId");
+        Integer movie_id = (Integer) request.getSession().getAttribute("movieId");
         request.getSession().setAttribute("movieId", null);
         Optional<Movie> movieOp = movieService.findById(movie_id);
         if(movieOp.isEmpty())
             return "redirect:/movies";
-        Discussion discussion = new Discussion(DiscussionType.M,text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null,new ArrayList<>());
-        discussionService.save(discussion);
+      //  Discussion discussion = new Discussion('M',text, title, Date.valueOf(LocalDate.now()),user,movieOp.get(),null);
+       // discussionService.save(discussion);
         return "redirect:/discussions";
     }
@@ -137,6 +136,7 @@
         if(personOp.isEmpty())
             return "redirect:/discussions";
-        Discussion discussion = new Discussion(DiscussionType.P,title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get(),new ArrayList<>());
-        discussionService.save(discussion);
+
+      //  Discussion discussion = new Discussion('P',title, text,Date.valueOf(LocalDate.now()),user,null,personOp.get());
+      //  discussionService.save(discussion);
         return "redirect:/discussions";
     }
Index: src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -2,7 +2,6 @@
 
 import com.wediscussmovies.project.exception.MovieIdNotFoundException;
-import com.wediscussmovies.project.model.Genre;
-import com.wediscussmovies.project.model.Movie;
-import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.*;
+
 import com.wediscussmovies.project.service.GenreService;
 import com.wediscussmovies.project.service.MovieService;
@@ -33,5 +32,5 @@
     public String getMovies(@RequestParam(required = false) String titleQuery, Model model){
         List<Movie> movies;
-        if(titleQuery == null || titleQuery.isEmpty()) {
+        if(titleQuery == null ) {
             movies = movieService.listAll();
         }
@@ -40,9 +39,8 @@
         }
 
-        movies.sort(Movie.comparatorTitle);
 
         model.addAttribute("movies", movies);
         model.addAttribute("contentTemplate", "moviesList");
-        return "template";
+        return "list";
     }
 
@@ -59,8 +57,8 @@
 
     @PostMapping("/{id}/delete")
-    public String addMovie(@PathVariable Long id){
+    public String addMovie(@PathVariable Integer id){
         Optional<Movie> movie = movieService.findById(id);
         if(movie.isPresent()){
-            movieService.deleteById(movie.get().getId());
+            movieService.deleteById(movie.get().getMovieId());
         }
         return "redirect:/movies";
@@ -122,5 +120,5 @@
 
         Movie movie = new Movie(title, description, image_url, airing_date,
-                    rating, director, actorsList, genreList);
+                    rating, director.getPersonId());
 
         movieService.save(movie);
@@ -131,5 +129,5 @@
     @PostMapping("/edit/confirm")
     public String editMoviePost(
-                                @RequestParam Long movie_id,
+                                @RequestParam Integer movie_id,
                                 @RequestParam String title,
                                @RequestParam String description,
@@ -198,12 +196,12 @@
         movieService.deleteById(movie_id);
 
-        movie.setActors(actorsList);
-        movie.setDirector(director);
-        movie.setGenres(genreList);
-        movie.setTitle(title);
-        movie.setDescription(description);
-        movie.setAringDate(airing_date);
-        movie.setImageUrl(image_url);
-        movie.setImbdRating(rating);
+//      //  movie.setActors(actorsList);
+//        movie.setDirector(director);
+//        movie.setGenres(genreList);
+//        movie.setTitle(title);
+//        movie.setDescription(description);
+//        movie.setAringDate(airing_date);
+//        movie.setImageUrl(image_url);
+//        movie.setImbdRating(rating);
 
         movieService.save(movie);
@@ -213,5 +211,5 @@
 
     @GetMapping("/{id}/edit")
-    public String editMovie(@PathVariable Long id, Model model){
+    public String editMovie(@PathVariable Integer id, Model model){
         Movie movie = movieService.findById(id).orElseThrow(() -> new MovieIdNotFoundException(id));
         model.addAttribute("directors", personService.findAllDirectors());
Index: src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/PersonsController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,5 +1,5 @@
 package com.wediscussmovies.project.web.controller;
 
-import com.wediscussmovies.project.model.Person;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.model.enumerations.PersonType;
 import com.wediscussmovies.project.service.PersonService;
@@ -15,5 +15,4 @@
 
 @Controller
-@RequestMapping(".")
 public class PersonsController {
     private final PersonService personSerivce;
@@ -101,5 +100,5 @@
             @RequestParam String name,
             @RequestParam String surname,
-            @RequestParam PersonType type,
+            @RequestParam Character type,
             @RequestParam Date date_of_birth,
             @RequestParam String image_url,
@@ -108,5 +107,5 @@
         if(personSerivce.save(person)){
             String toWhere = "actors";
-            if(type == PersonType.D)
+            //if(type == PersonType.D)
                 toWhere = "directors";
             return "redirect:/"+toWhere;
Index: src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ src/main/java/com/wediscussmovies/project/web/controller/ReplyController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -1,6 +1,7 @@
 package com.wediscussmovies.project.web.controller;
 
-import com.wediscussmovies.project.model.Reply;
+import com.wediscussmovies.project.model.*;
 import com.wediscussmovies.project.service.ReplyService;
+import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,4 +12,5 @@
 import java.util.Optional;
 
+@Controller
 public class ReplyController {
     private final ReplyService replyService;
@@ -37,5 +39,5 @@
         reply.setText(text);
         replyService.save(reply);
-        return "redirect:/discussions/"+reply.getDiscussion().getId();
+        return "redirect:/discussions/"+reply.getDiscussionId();
     }
 }
Index: src/main/java/com/wediscussmovies/project/web/controller/UserController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/UserController.java	(revision 7fafeade7bf35835297971768f9dc93f768c1ff0)
+++ 	(revision )
@@ -1,100 +1,0 @@
-package com.wediscussmovies.project.web.controller;
-
-import com.wediscussmovies.project.model.PasswordEncoder;
-import com.wediscussmovies.project.model.User;
-import com.wediscussmovies.project.model.exception.InvalidUserCredentialsException;
-import com.wediscussmovies.project.service.UserService;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import javax.servlet.http.HttpServletRequest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Optional;
-
-@Controller
-@RequestMapping("/")
-public class UserController {
-    private final UserService userService;
-
-    public UserController(UserService userService) {
-        this.userService = userService;
-    }
-
-    @GetMapping("/login")
-    public String getLoginPage(Model model){
-        return "login";
-    }
-
-    @PostMapping("/login/confirm")
-    public String confirmLogin(HttpServletRequest request, Model model,
-                               @RequestParam String username,
-                               @RequestParam String password){
-        Optional<User> user;
-        try{
-            password = PasswordEncoder.getEncodedPasswordString(password);
-        }
-        catch (NoSuchAlgorithmException ex){
-            model.addAttribute("hasError", true);
-            model.addAttribute("error", ex.getMessage());
-            return "login";
-        }
-
-        try{
-            user = this.userService.login(username, password);
-            request.getSession().setAttribute("user", user);
-            request.getSession().setAttribute("loggedIn",true);
-            return "redirect:/movies";
-        }
-        catch (InvalidUserCredentialsException ex){
-            model.addAttribute("hasError", true);
-            model.addAttribute("error", ex.getMessage());
-            return "login";
-        }
-    }
-
-    @GetMapping("/register")
-    public String getRegisterPage(){
-        return "register";
-    }
-
-    @PostMapping("/login/confirm")
-    public String confirmRegister(HttpServletRequest request,
-                                  @RequestParam String username,
-                                  @RequestParam String email,
-                                  @RequestParam String password,
-                                  @RequestParam String confirmPassword,
-                                  @RequestParam String name,
-                                  @RequestParam String surname){
-        Optional<User> user;
-
-        try{
-            password = PasswordEncoder.getEncodedPasswordString(password);
-            confirmPassword = PasswordEncoder.getEncodedPasswordString(confirmPassword);
-        }
-        catch (NoSuchAlgorithmException ex){
-            request.getSession().setAttribute("error", "Contact the administrators!");
-            request.getSession().setAttribute("hasError", "true");
-            return "redirect:/movies";
-        }
-
-        user = this.userService.register(request, email, password, confirmPassword, username, name, surname);
-        if(user.isEmpty()){
-            request.setAttribute("hasError", "true");
-        }else{
-            request.getSession().setAttribute("hasError", "false");
-            request.getSession().setAttribute("user", user.get());
-            request.getSession().setAttribute("loggedIn",true);
-        }
-        return "redirect:/movies";
-    }
-
-    @GetMapping
-    public String logout(HttpServletRequest request){
-        request.getSession().invalidate();
-        return "redirect:/login";
-    }
-}
Index: src/main/java/com/wediscussmovies/project/web/controller/UsersController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
+++ src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 3ded84dfbf8ff25bf27cc822ac97b84a063fa95a)
@@ -0,0 +1,98 @@
+//package com.wediscussmovies.project.web.controller;
+//
+//import com.wediscussmovies.project.model.PasswordEncoder;
+//import com.wediscussmovies.project.model.*;
+//import com.wediscussmovies.project.model.exception.InvalidUserCredentialsException;
+//import com.wediscussmovies.project.service.UserService;
+//import org.springframework.stereotype.Controller;
+//import org.springframework.ui.Model;
+//import org.springframework.web.bind.annotation.GetMapping;
+//import org.springframework.web.bind.annotation.PostMapping;
+//import org.springframework.web.bind.annotation.RequestParam;
+//
+//import javax.servlet.http.HttpServletRequest;
+//import java.security.NoSuchAlgorithmException;
+//import java.util.Optional;
+//
+//@Controller
+//public class UsersController{
+//    private final UserService userService;
+//
+//    public UsersController(UserService userService) {
+//        this.userService = userService;
+//    }
+//
+//    @GetMapping("/login")
+//    public String getLoginPage(Model model){
+//        return "login";
+//    }
+//
+//    @PostMapping("/login/confirm")
+//    public String confirmLogin(HttpServletRequest request, Model model,
+//                               @RequestParam String username,
+//                               @RequestParam String password){
+//        Optional<User> user;
+//        try{
+//            password = PasswordEncoder.getEncodedPasswordString(password);
+//        }
+//        catch (NoSuchAlgorithmException ex){
+//            model.addAttribute("hasError", true);
+//            model.addAttribute("error", ex.getMessage());
+//            return "login";
+//        }
+//
+//        try{
+//            user = this.userService.login(username, password);
+//            request.getSession().setAttribute("user", user);
+//            request.getSession().setAttribute("loggedIn",true);
+//            return "redirect:/movies";
+//        }
+//        catch (InvalidUserCredentialsException ex){
+//            model.addAttribute("hasError", true);
+//            model.addAttribute("error", ex.getMessage());
+//            return "login";
+//        }
+//    }
+//
+//    @GetMapping("/register")
+//    public String getRegisterPage(){
+//        return "register";
+//    }
+//
+//    @PostMapping("/login/confirm")
+//    public String confirmRegister(HttpServletRequest request,
+//                                  @RequestParam String username,
+//                                  @RequestParam String email,
+//                                  @RequestParam String password,
+//                                  @RequestParam String confirmPassword,
+//                                  @RequestParam String name,
+//                                  @RequestParam String surname){
+//        Optional<User> user;
+//
+//        try{
+//            password = PasswordEncoder.getEncodedPasswordString(password);
+//            confirmPassword = PasswordEncoder.getEncodedPasswordString(confirmPassword);
+//        }
+//        catch (NoSuchAlgorithmException ex){
+//            request.getSession().setAttribute("error", "Contact the administrators!");
+//            request.getSession().setAttribute("hasError", "true");
+//            return "redirect:/movies";
+//        }
+//
+//        user = this.userService.register(request, email, password, confirmPassword, username, name, surname);
+//        if(user.isEmpty()){
+//            request.setAttribute("hasError", "true");
+//        }else{
+//            request.getSession().setAttribute("hasError", "false");
+//            request.getSession().setAttribute("user", user.get());
+//            request.getSession().setAttribute("loggedIn",true);
+//        }
+//        return "redirect:/movies";
+//    }
+//
+//    @GetMapping
+//    public String logout(HttpServletRequest request){
+//        request.getSession().invalidate();
+//        return "redirect:/login";
+//    }
+//}
