|
Switching to hibernate 5.0.3 from 4.3.11 I started getting an error during schema validation when my service starts up:
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [ProcessingSolution_processing_solution_id] in table [processing_solutions_processing_datasets]
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.validateTable(SchemaValidatorImpl.java:85)
at org.hibernate.tool.schema.internal.SchemaValidatorImpl.doValidation(SchemaValidatorImpl.java:50)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:91)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:484)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
at com.cerner.wolfe.service.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:25)
I did not get this error with 4.3.11.
It looks like hibernate is now looking for a column named "ProcessingSolution_processing_solution_id" where previously it was looking for "processing_solutions_processing_solution_id". This column is on a join table created with:
create table processing_solutions_processing_datasets (
processing_solutions_processing_solution_id varchar(100) not null,
datasets_processing_dataset_id varchar(100) not null,
primary key (processing_solutions_processing_solution_id, datasets_processing_dataset_id)
);
The joined entities are (fields removed):
@Entity
@Table(name = "processing_solutions")
public class ProcessingSolution {
@Id
@Column(name = "processing_solution_id", nullable = false, unique = true, columnDefinition = "varchar(100)")
private String identifier;
@OneToMany
@Cascade(CascadeType.ALL)
private Set<ProcessingDataset> datasets = new HashSet<>(0);
and
@Entity
@Table(name = "processing_datasets")
public class ProcessingDataset {
@Id
@Column(name = "processing_dataset_id", nullable = false, columnDefinition = "varchar(100)")
private String identifier;
@ElementCollection
@CollectionTable(name = "processing_dataset_sources", joinColumns = @JoinColumn(name = "processing_dataset_id"))
@Column(name = "source", nullable = false, columnDefinition = "varchar(100)")
private Set<String> sources = new HashSet<>(0);
@ElementCollection
@CollectionTable(name = "processing_dataset_entitytypes", joinColumns = @JoinColumn(name = "processing_dataset_id"))
@Column(name = "entity_type", nullable = false, columnDefinition = "varchar(190)")
private Set<String> entityTypes = new HashSet<String>(0);
If I'm doing something wrong, please advise. As mentioned above, this was working under 4.3.11 but does not work under 5.0.0 nor 5.0.3.
|