无法自动创建表employee

来源:3-1 开发环境搭建

qq_慕村3282614

2020-11-30 10:07

十一月 30, 2020 10:01:15 上午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.6.Final}
十一月 30, 2020 10:01:15 上午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
十一月 30, 2020 10:01:15 上午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
十一月 30, 2020 10:01:15 上午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO:HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
十一月 30, 2020 10:01:20 上午 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
十一月 30, 2020 10:01:20 上午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate executeINFO: HHH000228: Running hbm2ddl schema update
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate executeINFO: HHH000102: Fetching database metadata
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000396: Updating schema
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000261: Table found: king.employee
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000037: Columns: [manager_id, department_id, employee_id, employee_name]
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000108: Foreign keys: []
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.TableMetadata <init>
INFO: HHH000126: Indexes: [primary]
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000388: Unsuccessful: alter table employee add column id integer not null
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: Table 'spring_data.employee' doesn't exist
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000388: Unsuccessful: alter table employee add column age integer
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: Table 'spring_data.employee' doesn't exist
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000388: Unsuccessful: alter table employee add column name varchar(20)
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: Table 'spring_data.employee' doesn't exist
十一月 30, 2020 10:01:20 上午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete

连接的数据库名字是 spring_data,不知道前面为什么先显示 INFO: HHH000261: Table found: king.employee,我其他数据库king里的employee
写回答 关注

1回答

  • SteveCode
    2021-06-12 14:24:49

    在bean-new.xml  中开启。根据实体类自动创建表

轻松愉快之玩转SpringData

利用Spring Data提高开发效率,提升程序员的幸福指数

34091 学习 · 119 问题

查看课程

相似问题