Eclipse + MySql + Hibernate, a good introduction?

I am looking for a tutorial explaining how to work with these three technologies, I found this one , but it works with HyperSql DB (yes, I edited hibernate.cfg.xml to connect to MySql ... but I just got a bunch of errors).

+3
source share
3 answers

Creating a script table is incorrect for the sleep generator strategy that you are currently using. As I said, your primary key should be defined as auto-increment:

CREATE TABLE COURSES (
  COURSE_ID int(11) NOT NULL AUTO_INCREMENT,
  COURSE_NAME varchar(20) DEFAULT NULL,
  PRIMARY KEY (COURSE_ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

You should let SchemaExport generate your DDL for you, it usually prevents such errors;)

+1

<generator class="identity">. native , auto_increment.

+1

The problem was solved using Toad for MySQL "to create a table when setting the column as the primary key, I just cleared the" Default "and set the AutoIncrement property to true.

+1
source

Source: https://habr.com/ru/post/1734696/


All Articles