我有下一个hibernate.properties
文件:
hibernate.hbm2ddl.auto = none
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://127.0.0.1:5432/virto
hibernate.connection.username = user
hibernate.connection.password = password
hibernate.dialect = org.hibernate.dialect.PostgreSQL94Dialect
hibernate.default_schema = virto_users
但是hibernate仍然试图重新创建表:
2017-11-22 06:25:59.657 INFO 8907 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-11-22 06:25:59.659 INFO 8907 --- [ main] org.hibernate.cfg.Environment : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.postgresql.Driver, hibernate.hbm2ddl.auto=none, hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialect, hibernate.default_schema=virto_users, hibernate.connection.password=****, hibernate.connection.username=user, hibernate.connection.url=jdbc:postgresql://127.0.0.1:5432/virto, hibernate.bytecode.use_reflection_optimizer=false}
2017-11-22 06:25:59.660 INFO 8907 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-11-22 06:25:59.707 INFO 8907 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-11-22 06:25:59.830 INFO 8907 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2017-11-22 06:26:00.044 INFO 8907 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2017-11-22 06:26:00.046 INFO 8907 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@5abf6a99
2017-11-22 06:26:00.158 WARN 8907 --- [ main] org.hibernate.orm.deprecation : HHH90000014: Found use of deprecated [org.hibernate.id.SequenceGenerator] sequence-based id generator; use org.hibernate.id.enhanced.SequenceStyleGenerator instead. See Hibernate Domain Model Mapping Guide for details.
2017-11-22 06:26:00.388 INFO 8907 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2017-11-22 06:26:00.394 DEBUG 8907 --- [ main] org.hibernate.SQL : drop table if exists virto_users.users cascade
2017-11-22 06:26:00.400 DEBUG 8907 --- [ main] org.hibernate.SQL : drop sequence virto_users.hibernate_sequence
2017-11-22 06:26:00.404 ERROR 8907 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: drop sequence virto_users.hibernate_sequence
2017-11-22 06:26:00.404 ERROR 8907 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: sequence "hibernate_sequence" does not exist
2017-11-22 06:26:00.404 DEBUG 8907 --- [ main] org.hibernate.SQL : create table virto_users.users (id int8 not null, birthdate timestamp not null, email varchar(255) not null, first_name varchar(255) not null, hash varchar(255) not null, last_name varchar(255) not null, salt int4 not null, primary key (id))
2017-11-22 06:26:00.408 ERROR 8907 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table virto_users.users (id int8 not null, birthdate timestamp not null, email varchar(255) not null, first_name varchar(255) not null, hash varchar(255) not null, last_name varchar(255) not null, salt int4 not null, primary key (id))
2017-11-22 06:26:00.408 ERROR 8907 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : ERROR: permission denied for schema virto_users
Position: 14
如何关闭这一代?
P.S。我尝试使用update
和validate
模式而不是未记录的none
,但结果是相同的。