I have MySQL running locally and have set it up using the below tables (plus many more). The application runs fine locally, but I'm trying to convert this to mariaDB, so it can run on anyone's computer easily. The error I receive is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
Initialization of bean failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException:
Failed to execute SQL script statement #3 of URL
[file:/C:/scoring/out/production/resources/data.sql]:
CREATE OR REPLACE VIEW singlesAggregate AS
SELECT athlete, classification, gender, team, SUM(total) total
FROM (
SELECT athlete, classification, gender, total, team
FROM singlesData
) AS a
GROUP BY athlete, classification, gender ORDER BY total DESC;
nested exception is java.sql.SQLException: 'trap.singlesaggregate' is not VIEW
CREATE OR REPLACE VIEW singlesAggregate AS
SELECT athlete, classification, gender, team, SUM(total) total
FROM (
SELECT athlete, classification, gender, total, team
FROM singlesData
) AS a
GROUP BY athlete, classification, gender
ORDER BY total DESC;
The problem is mariaDB doesn't accept `CREATE OR REPLACE VIEW` it needs to be `CREATE VIEW IF NOT EXISTS`