我在我的应用程序中使用休眠。我想立即编写测试。我用数据获取数据库。在测试数据库之前应该清楚。我想如果我写
<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
在我的配置中 - 它对我有帮助。但是休眠尝试以随机顺序删除所有表。我看到以下日志:
INFO ClassPathXmlApplicationContext - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@432a0f6c: startup date [Fri Sep 20 15:16:06 MSK 2013]; root of context hierarchy
INFO XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [test/BeanConfig.xml]
INFO XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [test/data.xml]
INFO DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@75be16f5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,candidateDao,eventDaoImpl,eventStatusDao,eventTypeDao,noteDao,skillDao,userDao,vacancyDao,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,dataSource,sessionFactory,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
INFO DriverManagerDataSource - Loaded JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
INFO Version - HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
INFO Version - HHH000412: Hibernate Core {4.2.1.Final}
INFO Environment - HHH000206: hibernate.properties not found
INFO Environment - HHH000021: Bytecode provider name : javassist
INFO Configuration - HHH000044: Configuring from URL: file:/C:/Users/Nikolay_Tkachev/workspace/HHSystem/Core/target/classes/test/hibernate.cfg.xml
INFO Configuration - HHH000041: Configured SessionFactory: null
INFO Dialect - HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
INFO TransactionFactoryInitiator - HHH000399: Using default transaction strategy (direct JDBC transactions)
INFO ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO Version - HV000001: Hibernate Validator 4.3.1.Final
INFO SchemaExport - HHH000227: Running hbm2ddl schema export
Hibernate: alter table candidate drop constraint FK_0a095d3c05344292b630736d577
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate drop constraint FK_0a095d3c05344292b630736d577
ERROR SchemaExport - FK_0a095d3c05344292b630736d577 не является ограничением.
Hibernate: alter table candidate_skill drop constraint FK_f487e8a130cb44478cf45d2bed6
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate_skill drop constraint FK_f487e8a130cb44478cf45d2bed6
ERROR SchemaExport - FK_f487e8a130cb44478cf45d2bed6 не является ограничением.
Hibernate: alter table candidate_skill drop constraint FK_d5e271d145df45948a4928ef92f
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate_skill drop constraint FK_d5e271d145df45948a4928ef92f
ERROR SchemaExport - FK_d5e271d145df45948a4928ef92f не является ограничением.
Hibernate: alter table candidate_status drop constraint FK_26a9279492b14ebd9068df09af9
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate_status drop constraint FK_26a9279492b14ebd9068df09af9
ERROR SchemaExport - FK_26a9279492b14ebd9068df09af9 не является ограничением.
Hibernate: alter table candidate_status drop constraint FK_d6fda5bc80c140bb8053a15595b
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate_status drop constraint FK_d6fda5bc80c140bb8053a15595b
ERROR SchemaExport - FK_d6fda5bc80c140bb8053a15595b не является ограничением.
Hibernate: alter table candidate_status drop constraint FK_04345df148d644c2a458c48aa7a
ERROR SchemaExport - HHH000389: Unsuccessful: alter table candidate_status drop constraint FK_04345df148d644c2a458c48aa7a
ERROR SchemaExport - FK_04345df148d644c2a458c48aa7a не является ограничением.
Hibernate: alter table event drop constraint FK_3221e14f1a5546aea264084277b
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event drop constraint FK_3221e14f1a5546aea264084277b
ERROR SchemaExport - FK_3221e14f1a5546aea264084277b не является ограничением.
Hibernate: alter table event drop constraint FK_1e065236f2aa41a886818431a74
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event drop constraint FK_1e065236f2aa41a886818431a74
ERROR SchemaExport - FK_1e065236f2aa41a886818431a74 не является ограничением.
Hibernate: alter table event drop constraint FK_8cd8c0859ba8443e9f6ec783473
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event drop constraint FK_8cd8c0859ba8443e9f6ec783473
ERROR SchemaExport - FK_8cd8c0859ba8443e9f6ec783473 не является ограничением.
Hibernate: alter table event_candidate drop constraint FK_04a181b9bf6842ce808631f5b26
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event_candidate drop constraint FK_04a181b9bf6842ce808631f5b26
ERROR SchemaExport - FK_04a181b9bf6842ce808631f5b26 не является ограничением.
Hibernate: alter table event_candidate drop constraint FK_60493ff24dc343bf9edd017b5f1
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event_candidate drop constraint FK_60493ff24dc343bf9edd017b5f1
ERROR SchemaExport - FK_60493ff24dc343bf9edd017b5f1 не является ограничением.
Hibernate: alter table event_vacancy drop constraint FK_87e5ee2c1ed24cabb2a0e8472e8
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event_vacancy drop constraint FK_87e5ee2c1ed24cabb2a0e8472e8
ERROR SchemaExport - FK_87e5ee2c1ed24cabb2a0e8472e8 не является ограничением.
Hibernate: alter table event_vacancy drop constraint FK_99ca9c03c1a34a0d8c4c0e62a5b
ERROR SchemaExport - HHH000389: Unsuccessful: alter table event_vacancy drop constraint FK_99ca9c03c1a34a0d8c4c0e62a5b
ERROR SchemaExport - FK_99ca9c03c1a34a0d8c4c0e62a5b не является ограничением.
Hibernate: alter table note drop constraint FK_a30769362d244864aea0d90fa53
ERROR SchemaExport - HHH000389: Unsuccessful: alter table note drop constraint FK_a30769362d244864aea0d90fa53
ERROR SchemaExport - FK_a30769362d244864aea0d90fa53 не является ограничением.
Hibernate: alter table note drop constraint FK_9ea4fdfb6a4249cd8fc4365b08e
ERROR SchemaExport - HHH000389: Unsuccessful: alter table note drop constraint FK_9ea4fdfb6a4249cd8fc4365b08e
ERROR SchemaExport - FK_9ea4fdfb6a4249cd8fc4365b08e не является ограничением.
Hibernate: alter table note drop constraint FK_ef76fe39f36e41439347bbe0d50
ERROR SchemaExport - HHH000389: Unsuccessful: alter table note drop constraint FK_ef76fe39f36e41439347bbe0d50
ERROR SchemaExport - FK_ef76fe39f36e41439347bbe0d50 не является ограничением.
Hibernate: alter table vacancy drop constraint FK_78a4a7e3d0484999aedab350f6c
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy drop constraint FK_78a4a7e3d0484999aedab350f6c
ERROR SchemaExport - FK_78a4a7e3d0484999aedab350f6c не является ограничением.
Hibernate: alter table vacancy_candidate drop constraint FK_70b128e5e6a24a78b7b500feeb0
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_candidate drop constraint FK_70b128e5e6a24a78b7b500feeb0
ERROR SchemaExport - FK_70b128e5e6a24a78b7b500feeb0 не является ограничением.
Hibernate: alter table vacancy_candidate drop constraint FK_c9145cfab1c4417ba935cea8ca5
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_candidate drop constraint FK_c9145cfab1c4417ba935cea8ca5
ERROR SchemaExport - FK_c9145cfab1c4417ba935cea8ca5 не является ограничением.
Hibernate: alter table vacancy_skill drop constraint FK_66c9f60532da40249fe0286747d
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_skill drop constraint FK_66c9f60532da40249fe0286747d
ERROR SchemaExport - FK_66c9f60532da40249fe0286747d не является ограничением.
Hibernate: alter table vacancy_skill drop constraint FK_3e3cb30e74ca45f786bf86ad790
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_skill drop constraint FK_3e3cb30e74ca45f786bf86ad790
ERROR SchemaExport - FK_3e3cb30e74ca45f786bf86ad790 не является ограничением.
Hibernate: alter table vacancy_status drop constraint FK_f867af57b4374eb892c86b76076
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_status drop constraint FK_f867af57b4374eb892c86b76076
ERROR SchemaExport - FK_f867af57b4374eb892c86b76076 не является ограничением.
Hibernate: alter table vacancy_status drop constraint FK_da55313052974e3bafeb61dc55a
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_status drop constraint FK_da55313052974e3bafeb61dc55a
ERROR SchemaExport - FK_da55313052974e3bafeb61dc55a не является ограничением.
Hibernate: alter table vacancy_status drop constraint FK_958985ec3e7d43fcb8b01b12b0d
ERROR SchemaExport - HHH000389: Unsuccessful: alter table vacancy_status drop constraint FK_958985ec3e7d43fcb8b01b12b0d
ERROR SchemaExport - FK_958985ec3e7d43fcb8b01b12b0d не является ограничением.
Hibernate: drop table author
ERROR SchemaExport - HHH000389: Unsuccessful: drop table author
ERROR SchemaExport - Невозможно удалить объект "author", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table candidate
ERROR SchemaExport - HHH000389: Unsuccessful: drop table candidate
ERROR SchemaExport - Невозможно удалить объект "candidate", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table candidate_skill
Hibernate: drop table candidate_status
Hibernate: drop table event
ERROR SchemaExport - HHH000389: Unsuccessful: drop table event
ERROR SchemaExport - Невозможно удалить объект "event", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table event_candidate
Hibernate: drop table event_status
ERROR SchemaExport - HHH000389: Unsuccessful: drop table event_status
ERROR SchemaExport - Невозможно удалить объект "event_status", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table event_type
ERROR SchemaExport - HHH000389: Unsuccessful: drop table event_type
ERROR SchemaExport - Невозможно удалить объект "event_type", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table event_vacancy
Hibernate: drop table note
Hibernate: drop table skill
ERROR SchemaExport - HHH000389: Unsuccessful: drop table skill
ERROR SchemaExport - Невозможно удалить объект "skill", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table status_for_candidate
Hibernate: drop table status_for_vacancy
ERROR SchemaExport - HHH000389: Unsuccessful: drop table status_for_vacancy
ERROR SchemaExport - Невозможно удалить объект "status_for_vacancy", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table vacancy
ERROR SchemaExport - HHH000389: Unsuccessful: drop table vacancy
ERROR SchemaExport - Невозможно удалить объект "vacancy", так как на него ссылается ограничение FOREIGN KEY.
Hibernate: drop table vacancy_candidate
Hibernate: drop table vacancy_skill
Hibernate: drop table vacancy_status
Hibernate: create table author (id int identity not null, name varchar(255), surname varchar(255), login varchar(255) not null, password varchar(255), primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table author (id int identity not null, name varchar(255), surname varchar(255), login varchar(255) not null, password varchar(255), primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "author".
Hibernate: create table candidate (id int identity not null, name varchar(255), surname varchar(255), creation_date datetime, phone varchar(12), cv_url varchar(100), author_id int, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table candidate (id int identity not null, name varchar(255), surname varchar(255), creation_date datetime, phone varchar(12), cv_url varchar(100), author_id int, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "candidate".
Hibernate: create table candidate_skill (candidate_id int not null, skills_id int not null, primary key (candidate_id, skills_id))
Hibernate: create table candidate_status (id int identity not null, creation_date datetime, author_id int, candidate_id int, status_for_candidate_id int, primary key (id))
Hibernate: create table event (id int identity not null, creation_date datetime not null, description TEXT, event_date datetime not null, name varchar(255), author_id int, event_status_id int, event_type_id int, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table event (id int identity not null, creation_date datetime not null, description TEXT, event_date datetime not null, name varchar(255), author_id int, event_status_id int, event_type_id int, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "event".
Hibernate: create table event_candidate (events_id int not null, candidates_id int not null, primary key (events_id, candidates_id))
Hibernate: create table event_status (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table event_status (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "event_status".
Hibernate: create table event_type (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table event_type (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "event_type".
Hibernate: create table event_vacancy (events_id int not null, vacancies_id int not null, primary key (events_id, vacancies_id))
Hibernate: create table note (id int identity not null, creation_date datetime, text TEXT not null, author_id int, candidate_id int, vacancy_id int, primary key (id))
Hibernate: create table skill (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table skill (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "skill".
Hibernate: create table status_for_candidate (id int identity not null, name varchar(255) not null, primary key (id))
Hibernate: create table status_for_vacancy (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table status_for_vacancy (id int identity not null, name varchar(255) not null, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "status_for_vacancy".
Hibernate: create table vacancy (id int identity not null, creation_date datetime not null, description TEXT, name varchar(30) not null, author_id int, primary key (id))
ERROR SchemaExport - HHH000389: Unsuccessful: create table vacancy (id int identity not null, creation_date datetime not null, description TEXT, name varchar(30) not null, author_id int, primary key (id))
ERROR SchemaExport - В базе данных уже существует объект с именем "vacancy".
Hibernate: create table vacancy_candidate (vacancy_id int not null, candidate_id int not null, primary key (vacancy_id, candidate_id))
Hibernate: create table vacancy_skill (vacancy_id int not null, skill_id int not null, primary key (vacancy_id, skill_id))
Hibernate: create table vacancy_status (id int identity not null, creation_date datetime, author_id int, status_for_vacancy_id int, vacancy_id int, primary key (id))
Hibernate: alter table candidate add constraint FK_0a095d3c05344292b630736d577 foreign key (author_id) references author
Hibernate: alter table candidate_skill add constraint FK_f487e8a130cb44478cf45d2bed6 foreign key (skills_id) references skill
Hibernate: alter table candidate_skill add constraint FK_d5e271d145df45948a4928ef92f foreign key (candidate_id) references candidate
Hibernate: alter table candidate_status add constraint FK_26a9279492b14ebd9068df09af9 foreign key (author_id) references author
Hibernate: alter table candidate_status add constraint FK_d6fda5bc80c140bb8053a15595b foreign key (candidate_id) references candidate
Hibernate: alter table candidate_status add constraint FK_04345df148d644c2a458c48aa7a foreign key (status_for_candidate_id) references status_for_candidate
Hibernate: alter table event add constraint FK_3221e14f1a5546aea264084277b foreign key (author_id) references author
Hibernate: alter table event add constraint FK_1e065236f2aa41a886818431a74 foreign key (event_status_id) references event_status
Hibernate: alter table event add constraint FK_8cd8c0859ba8443e9f6ec783473 foreign key (event_type_id) references event_type
Hibernate: alter table event_candidate add constraint FK_04a181b9bf6842ce808631f5b26 foreign key (candidates_id) references candidate
Hibernate: alter table event_candidate add constraint FK_60493ff24dc343bf9edd017b5f1 foreign key (events_id) references event
Hibernate: alter table event_vacancy add constraint FK_87e5ee2c1ed24cabb2a0e8472e8 foreign key (vacancies_id) references vacancy
Hibernate: alter table event_vacancy add constraint FK_99ca9c03c1a34a0d8c4c0e62a5b foreign key (events_id) references event
Hibernate: alter table note add constraint FK_a30769362d244864aea0d90fa53 foreign key (author_id) references author
Hibernate: alter table note add constraint FK_9ea4fdfb6a4249cd8fc4365b08e foreign key (candidate_id) references candidate
Hibernate: alter table note add constraint FK_ef76fe39f36e41439347bbe0d50 foreign key (vacancy_id) references vacancy
Hibernate: alter table vacancy add constraint FK_78a4a7e3d0484999aedab350f6c foreign key (author_id) references author
Hibernate: alter table vacancy_candidate add constraint FK_70b128e5e6a24a78b7b500feeb0 foreign key (candidate_id) references candidate
Hibernate: alter table vacancy_candidate add constraint FK_c9145cfab1c4417ba935cea8ca5 foreign key (vacancy_id) references vacancy
Hibernate: alter table vacancy_skill add constraint FK_66c9f60532da40249fe0286747d foreign key (skill_id) references skill
Hibernate: alter table vacancy_skill add constraint FK_3e3cb30e74ca45f786bf86ad790 foreign key (vacancy_id) references vacancy
Hibernate: alter table vacancy_status add constraint FK_f867af57b4374eb892c86b76076 foreign key (author_id) references author
Hibernate: alter table vacancy_status add constraint FK_da55313052974e3bafeb61dc55a foreign key (status_for_vacancy_id) references status_for_vacancy
Hibernate: alter table vacancy_status add constraint FK_958985ec3e7d43fcb8b01b12b0d foreign key (vacancy_id) references vacancy
INFO SchemaExport - HHH000230: Schema export complete
任何消息 - 我的母语。这些消息返回 jdbc 驱动程序。这些消息的要点是,表与另一个表有约束。
你能帮我想办法清除我的数据库吗?