【发布时间】:2018-05-11 11:20:29
【问题描述】:
我正在学习 spring boot 和 jpa。 我想创建 junit 测试代码,并希望通过设置 application.properties 来创建表,如下所示。
spring.datasource.url=jdbc:mysql://[my db ip]:3306/cookingstep
spring.datasource.username=root
spring.datasource.password=[password]
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql=true
但是当我运行测试代码时
@RunWith(SpringRunner.class)
@SpringBootTest
public class MemberServiceTest {
private Account account;
@Autowired
private AccountService accountService;
@Before
public void init(){
account = Account.of("musicovery12@naver.com", "asdasd");
account.setSecurity(AccountSecurity.of(1, 0, 0));
account.setProfile(AccountProfile.of("playmaker"));
}
@Test
public void test1(){
// stub
}
}
eclipse 返回异常。
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [account]
... 46 common frames omitted
为了获得更多线索,我在我的 mysql 服务器中添加了几个表。 但是当我运行测试代码时,所有的表都被删除了。
为什么会这样?我错过了什么吗?
编辑:当我设置 ddl-auto 标志来创建时
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
日食打印
2017-11-28 14:17:31.671 INFO 11448 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.12.Final}
2017-11-28 14:17:31.673 INFO 11448 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2017-11-28 14:17:31.674 INFO 11448 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-11-28 14:17:31.715 INFO 11448 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-11-28 14:17:31.978 INFO 11448 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-11-28 14:17:32.614 INFO 11448 --- [ main] org.hibernate.tuple.PojoInstantiator : HHH000182: No default (no-argument) constructor for class: com.musicovery12.cookingstep.core.entity.AccountSecurity (class must be instantiated by Interceptor)
2017-11-28 14:17:32.621 INFO 11448 --- [ main] org.hibernate.tuple.PojoInstantiator : HHH000182: No default (no-argument) constructor for class: com.musicovery12.cookingstep.core.entity.AccountProfile (class must be instantiated by Interceptor)
2017-11-28 14:17:32.790 INFO 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
Hibernate: alter table community drop foreign key FK9y1pb8juolp2ln0wo3wagt9ml
2017-11-28 14:17:32.804 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community drop foreign key FK9y1pb8juolp2ln0wo3wagt9ml
2017-11-28 14:17:32.804 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.community' doesn't exist
Hibernate: alter table community_reply drop foreign key FKcdymjfm93hf9bm387838lxm15
2017-11-28 14:17:32.808 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply drop foreign key FKcdymjfm93hf9bm387838lxm15
2017-11-28 14:17:32.808 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.community_reply' doesn't exist
Hibernate: alter table community_reply drop foreign key FK5p4xc1ee67c18oq9jpj1niojt
2017-11-28 14:17:32.812 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply drop foreign key FK5p4xc1ee67c18oq9jpj1niojt
2017-11-28 14:17:32.812 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.community_reply' doesn't exist
Hibernate: alter table community_reply drop foreign key FKo7cfbjqgcbt3y6qdr4qqfhsgb
2017-11-28 14:17:32.816 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply drop foreign key FKo7cfbjqgcbt3y6qdr4qqfhsgb
2017-11-28 14:17:32.817 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.community_reply' doesn't exist
Hibernate: alter table food_category2 drop foreign key FKqb8vaccerfscomhbaxws4tdgf
2017-11-28 14:17:32.820 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table food_category2 drop foreign key FKqb8vaccerfscomhbaxws4tdgf
2017-11-28 14:17:32.821 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.food_category2' doesn't exist
Hibernate: alter table recipe drop foreign key FK8b8rgugpgilubta3ltm6jysuq
2017-11-28 14:17:32.824 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe drop foreign key FK8b8rgugpgilubta3ltm6jysuq
2017-11-28 14:17:32.824 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.recipe' doesn't exist
Hibernate: alter table recipe drop foreign key FK9akcvi24fevvb9hy27tdyscsg
2017-11-28 14:17:32.828 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe drop foreign key FK9akcvi24fevvb9hy27tdyscsg
2017-11-28 14:17:32.828 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.recipe' doesn't exist
Hibernate: alter table recipe_rate drop foreign key FKtdg3k1b3pfbbl20bppbmpd1bv
2017-11-28 14:17:32.831 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_rate drop foreign key FKtdg3k1b3pfbbl20bppbmpd1bv
2017-11-28 14:17:32.831 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.recipe_rate' doesn't exist
Hibernate: alter table recipe_rate drop foreign key FKg7olg4nasa3ugg4ftoyj2p6ja
2017-11-28 14:17:32.835 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_rate drop foreign key FKg7olg4nasa3ugg4ftoyj2p6ja
2017-11-28 14:17:32.835 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.recipe_rate' doesn't exist
Hibernate: alter table recipe_step drop foreign key FKtnj83chr1op6sw7341r4mlh1s
2017-11-28 14:17:32.839 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_step drop foreign key FKtnj83chr1op6sw7341r4mlh1s
2017-11-28 14:17:32.839 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.recipe_step' doesn't exist
Hibernate: alter table user_role drop foreign key FK1qr00fsigpme3xo4v2bj2vvlr
2017-11-28 14:17:32.842 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role drop foreign key FK1qr00fsigpme3xo4v2bj2vvlr
2017-11-28 14:17:32.842 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.user_role' doesn't exist
Hibernate: alter table user_role drop foreign key FKgi4gmyt885payn4fg1ooa56qc
2017-11-28 14:17:32.846 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role drop foreign key FKgi4gmyt885payn4fg1ooa56qc
2017-11-28 14:17:32.846 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.user_role' doesn't exist
Hibernate: drop table if exists account
Hibernate: drop table if exists account_profile
Hibernate: drop table if exists account_security
Hibernate: drop table if exists community
Hibernate: drop table if exists community_reply
Hibernate: drop table if exists food_category1
Hibernate: drop table if exists food_category2
Hibernate: drop table if exists recipe
Hibernate: drop table if exists recipe_rate
Hibernate: drop table if exists recipe_step
Hibernate: drop table if exists role_def
Hibernate: drop table if exists user_role
Hibernate: create table account (acc# integer not null auto_increment, email varchar(255) not null, password varchar(255), primary key (acc#))
2017-11-28 14:17:32.945 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table account (acc# integer not null auto_increment, email varchar(255) not null, password varchar(255), primary key (acc#))
2017-11-28 14:17:32.946 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table account_profile (acc# integer not null, nickname varchar(255) not null, primary key (acc#))
2017-11-28 14:17:32.950 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table account_profile (acc# integer not null, nickname varchar(255) not null, primary key (acc#))
2017-11-28 14:17:32.950 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table account_security (acc# integer not null, activate_key varchar(255) not null, activated integer, enabled integer, login_failed integer not null, primary key (acc#))
2017-11-28 14:17:32.957 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table account_security (acc# integer not null, activate_key varchar(255) not null, activated integer, enabled integer, login_failed integer not null, primary key (acc#))
2017-11-28 14:17:32.958 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table community (article# integer not null auto_increment, attach_filename varchar(255), attach_url varchar(255), content varchar(255) not null, reg_dt datetime, read_cnt integer not null, title varchar(255) not null, acc# integer, primary key (article#))
2017-11-28 14:17:32.962 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table community (article# integer not null auto_increment, attach_filename varchar(255), attach_url varchar(255), content varchar(255) not null, reg_dt datetime, read_cnt integer not null, title varchar(255) not null, acc# integer, primary key (article#))
2017-11-28 14:17:32.962 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table community_reply (reply# integer not null auto_increment, content varchar(255) not null, reg_dt datetime not null, acc# integer, article# integer, reply_at integer, primary key (reply#))
2017-11-28 14:17:32.968 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table community_reply (reply# integer not null auto_increment, content varchar(255) not null, reg_dt datetime not null, acc# integer, article# integer, reply_at integer, primary key (reply#))
2017-11-28 14:17:32.968 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table food_category1 (category# integer not null auto_increment, category_nm varchar(255) not null, primary key (category#))
2017-11-28 14:17:32.972 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table food_category1 (category# integer not null auto_increment, category_nm varchar(255) not null, primary key (category#))
2017-11-28 14:17:32.972 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table food_category2 (category# integer not null auto_increment, category_nm varchar(255) not null, super integer, primary key (category#))
2017-11-28 14:17:32.976 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table food_category2 (category# integer not null auto_increment, category_nm varchar(255) not null, super integer, primary key (category#))
2017-11-28 14:17:32.976 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table recipe (recipe# integer not null auto_increment, avg_rate float, cook_time varchar(255), reg_dt datetime, description varchar(255), food_name varchar(255) not null, ingredients varchar(255), kcal varchar(255), main_img_url varchar(255), title varchar(255) not null, video_embed varchar(255), acc# integer, category# integer, primary key (recipe#))
2017-11-28 14:17:32.980 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table recipe (recipe# integer not null auto_increment, avg_rate float, cook_time varchar(255), reg_dt datetime, description varchar(255), food_name varchar(255) not null, ingredients varchar(255), kcal varchar(255), main_img_url varchar(255), title varchar(255) not null, video_embed varchar(255), acc# integer, category# integer, primary key (recipe#))
2017-11-28 14:17:32.980 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table recipe_rate (rate# integer not null auto_increment, reg_dt datetime not null, message varchar(255), point float not null, acc# integer, recipe# integer, primary key (rate#))
2017-11-28 14:17:32.984 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table recipe_rate (rate# integer not null auto_increment, reg_dt datetime not null, message varchar(255), point float not null, acc# integer, recipe# integer, primary key (rate#))
2017-11-28 14:17:32.984 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table recipe_step (step# integer not null auto_increment, content varchar(255) not null, img_file_nm varchar(255), img_url varchar(255), order integer not null, recipe# integer, primary key (step#))
2017-11-28 14:17:32.989 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table recipe_step (step# integer not null auto_increment, content varchar(255) not null, img_file_nm varchar(255), img_url varchar(255), order integer not null, recipe# integer, primary key (step#))
2017-11-28 14:17:32.989 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table role_def (role# integer not null auto_increment, role_nm varchar(255), primary key (role#))
2017-11-28 14:17:32.993 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table role_def (role# integer not null auto_increment, role_nm varchar(255), primary key (role#))
2017-11-28 14:17:32.993 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: create table user_role (acc# integer not null, role# integer not null, primary key (acc#, role#))
2017-11-28 14:17:32.996 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table user_role (acc# integer not null, role# integer not null, primary key (acc#, role#))
2017-11-28 14:17:32.996 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table account add constraint UK_q0uja26qgu1atulenwup9rxyr unique (email)
2017-11-28 14:17:33.000 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table account add constraint UK_q0uja26qgu1atulenwup9rxyr unique (email)
2017-11-28 14:17:33.000 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.account' doesn't exist
Hibernate: alter table account_profile add constraint UKr3qi55pb5s42m9hk3u0qen1lk unique (nickname)
2017-11-28 14:17:33.006 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table account_profile add constraint UKr3qi55pb5s42m9hk3u0qen1lk unique (nickname)
2017-11-28 14:17:33.006 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.account_profile' doesn't exist
Hibernate: alter table account_security add constraint UK_esxavamso3j61bund9kqmy3gf unique (activate_key)
2017-11-28 14:17:33.010 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table account_security add constraint UK_esxavamso3j61bund9kqmy3gf unique (activate_key)
2017-11-28 14:17:33.010 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.account_security' doesn't exist
Hibernate: alter table food_category1 add constraint UK_373yh8ggjf4d327sopme32crk unique (category_nm)
2017-11-28 14:17:33.013 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table food_category1 add constraint UK_373yh8ggjf4d327sopme32crk unique (category_nm)
2017-11-28 14:17:33.013 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.food_category1' doesn't exist
Hibernate: alter table food_category2 add constraint UK888gq3iu8ld4nxj1yxgdguklm unique (category_nm)
2017-11-28 14:17:33.017 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table food_category2 add constraint UK888gq3iu8ld4nxj1yxgdguklm unique (category_nm)
2017-11-28 14:17:33.017 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'cookingstep.food_category2' doesn't exist
Hibernate: alter table community add constraint FK9y1pb8juolp2ln0wo3wagt9ml foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.020 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community add constraint FK9y1pb8juolp2ln0wo3wagt9ml foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.021 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table community_reply add constraint FKcdymjfm93hf9bm387838lxm15 foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.024 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply add constraint FKcdymjfm93hf9bm387838lxm15 foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.024 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table community_reply add constraint FK5p4xc1ee67c18oq9jpj1niojt foreign key (article#) references community (article#)
2017-11-28 14:17:33.028 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply add constraint FK5p4xc1ee67c18oq9jpj1niojt foreign key (article#) references community (article#)
2017-11-28 14:17:33.028 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table community_reply add constraint FKo7cfbjqgcbt3y6qdr4qqfhsgb foreign key (reply_at) references community_reply (reply#)
2017-11-28 14:17:33.032 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table community_reply add constraint FKo7cfbjqgcbt3y6qdr4qqfhsgb foreign key (reply_at) references community_reply (reply#)
2017-11-28 14:17:33.032 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table food_category2 add constraint FKqb8vaccerfscomhbaxws4tdgf foreign key (super) references food_category1 (category#)
2017-11-28 14:17:33.035 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table food_category2 add constraint FKqb8vaccerfscomhbaxws4tdgf foreign key (super) references food_category1 (category#)
2017-11-28 14:17:33.035 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table recipe add constraint FK8b8rgugpgilubta3ltm6jysuq foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.039 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe add constraint FK8b8rgugpgilubta3ltm6jysuq foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.039 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table recipe add constraint FK9akcvi24fevvb9hy27tdyscsg foreign key (category#) references food_category2 (category#)
2017-11-28 14:17:33.043 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe add constraint FK9akcvi24fevvb9hy27tdyscsg foreign key (category#) references food_category2 (category#)
2017-11-28 14:17:33.043 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table recipe_rate add constraint FKtdg3k1b3pfbbl20bppbmpd1bv foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.047 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_rate add constraint FKtdg3k1b3pfbbl20bppbmpd1bv foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.048 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table recipe_rate add constraint FKg7olg4nasa3ugg4ftoyj2p6ja foreign key (recipe#) references recipe (recipe#)
2017-11-28 14:17:33.052 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_rate add constraint FKg7olg4nasa3ugg4ftoyj2p6ja foreign key (recipe#) references recipe (recipe#)
2017-11-28 14:17:33.052 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table recipe_step add constraint FKtnj83chr1op6sw7341r4mlh1s foreign key (recipe#) references recipe (recipe#)
2017-11-28 14:17:33.056 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table recipe_step add constraint FKtnj83chr1op6sw7341r4mlh1s foreign key (recipe#) references recipe (recipe#)
2017-11-28 14:17:33.057 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table user_role add constraint FK1qr00fsigpme3xo4v2bj2vvlr foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.061 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role add constraint FK1qr00fsigpme3xo4v2bj2vvlr foreign key (acc#) references account (acc#)
2017-11-28 14:17:33.061 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Hibernate: alter table user_role add constraint FKgi4gmyt885payn4fg1ooa56qc foreign key (role#) references role_def (role#)
2017-11-28 14:17:33.066 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_role add constraint FKgi4gmyt885payn4fg1ooa56qc foreign key (role#) references role_def (role#)
2017-11-28 14:17:33.066 ERROR 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
2017-11-28 14:17:33.066 INFO 11448 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
案例关闭 - 运行 jpa 应用程序时无法识别“#”字符。 '#' 字符分配给帐户表的 acc# 列。而且我没想过要上传我的实体信息,所以没人能排查问题。
【问题讨论】:
-
为什么您的 JPA 提供商认为在您简单地要求它验证模式时尝试修改模式是可以的?建议你提出一个错误就可以了。关于为什么您的表不存在,请查看表名的区分大小写
标签: spring jpa spring-boot