I have seen several related questions and their answers, but it is not helping my case.
I have a Spring boot application, where I have created entities using Jhipster, plus I have added some manual changelog changesets myself.
I have a Doctor entity, which contains a One-to-Many uni-directional relationship with 'Specialty' where 'Doctor' is the owner of the relationship. So I specified a Join table that will store Doctor and Specialty foreign keys.
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable( name="T_DOCTOR_SPECIALTY", joinColumns = @JoinColumn( name="doctor_id"), inverseJoinColumns = @JoinColumn( name="specialty_id") ) private List<Specialty> specialties = new ArrayList<>();
For this, I added a changelog file, that even contains the tag to ignore specialty if it already exists,
<changeSet id="20150415081455" author="waqas"> <preConditions onFail="MARK_RAN"> <tableExists tableName="T_DOCTOR_SPECIALTY"/> <changeSet id="20150415081221" author="waqas"> <createTable tableName="T_DOCTOR_SPECIALTY"> ...
Then, I create a new database with no tables and run the application, but I get the following exception:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 't_doctor_specialty' already exists at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_40] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:...