For educational purposes, I want to write an application on Spring + Hibernate with the possibility of authorization and sending messages. I created entities, service and controller, but when I go to the start page on which the list of registered users is selected, the error could not extract ResultSet . I mean that somewhere there is a cant, but because of the lack of experience it is impossible to find it, Google also did not help.
|
ERROR: column messages0_.user_id does not exist, apparently in the database, themessagestable does not have theuser_idfield - MrFylypenkosession.createQuery("from net.bleser.entity.User as user where user.username='"+username+"'", User.class)- with a ruler. - Romanuser_idandid_userare different fields! Made a pull request for auto-generating tables, you can accept the request. You are missing a little for this project, duplication of bins in xml and annotations, entities have no default constructor, and one gett / set. This is what immediately caught my eye. Here a lot more then pops up. - MrFylypenkoSpringandHibernate, I understand that my code is poor. But still, why is the name used for theuser_idfielduser_idsince I wrote in the annotation which fields to link@JoinTable(name = "user_roles", joinColumns = @JoinColumn(name = "id_user"), inverseJoinColumns = @JoinColumn(name = "id_role")- Bleser