Hello. Trying to figure out Hibernate and create a simple table in the mysql database. But the table does not want to be created and I can not figure out why. What gives the console:
янв 28, 2018 12:39:32 AM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.2.10.Final} янв 28, 2018 12:39:32 AM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found янв 28, 2018 12:39:33 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final} янв 28, 2018 12:39:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) янв 28, 2018 12:39:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate] янв 28, 2018 12:39:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {user=root, password=****} янв 28, 2018 12:39:33 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false янв 28, 2018 12:39:33 AM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init> INFO: HHH000115: Hibernate connection pool size: 20 (min=1) янв 28, 2018 12:39:35 AM org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect янв 28, 2018 12:39:36 AM org.hibernate.validator.internal.util.Version <clinit> INFO: HV000001: Hibernate Validator 6.0.7.Final янв 28, 2018 12:39:36 AM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@1d730606' hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration SYSTEM "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/hibernate</property> <property name="connection.username">root</property> <property name="connection.password" /> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <property name="show_sql">true</property> <property name="hbm2ddl.auto">create</property> <mapping class="User" /> </session-factory> </hibernate-configuration> User.java
@Entity @Table(name="user") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") private long id; private int age; @Column(length = 50) private String firstname; @Column(length = 50) private String lastname;