From 94cabeb695bf9c349948c8019d939ca8595b81a1 Mon Sep 17 00:00:00 2001 From: Tim Holloway Date: Tue, 18 Oct 2022 19:50:59 -0400 Subject: [PATCH] Migrated to MySQL and found some JPA sloppiness in sqlite's field definitions. Prepping to use ImageIO for "webp" images. --- application.properties | 15 ++++++--- pom.xml | 32 +++++++++++++++++++ .../gourmetj/SpringPrimeFacesApplication.java | 2 ++ .../gourmetj/persistence/model/Recipe.java | 12 +++---- .../resources/WEB-INF/faces-config.xml | 4 +-- .../META-INF/resources/detailEdit.xhtml | 2 +- .../resources/error/viewExpired.xhtml | 2 +- .../META-INF/resources/recipeDetails.xhtml | 3 +- src/main/resources/application.yml | 10 ++++-- 9 files changed, 64 insertions(+), 18 deletions(-) diff --git a/application.properties b/application.properties index f0afec8..db88985 100644 --- a/application.properties +++ b/application.properties @@ -1,4 +1,6 @@ +# THIS is the application properties used when testing in the IDE +# The application.yml (production) is ignored. #joinfaces.jsf.project-stage=development # They lied. This doesn't work: joinfaces.primefaces.theme=cupertino @@ -10,12 +12,15 @@ server.servlet.context-parameters.primefaces.THEME=omega spring.thymeleaf.enabled=false server.error.whitelabel.enabled=false -spring.datasource.url=jdbc:sqlite:${home}/recipes.db -#spring.datasource.username=dbuser -#pring.datasource.password=dbpass -spring.datasource.driverClassName=org.sqlite.JDBC +spring.datasource.url=jdbc:mysql://dbase/recipes +#jdbc:sqlite:${home}/recipes.db +spring.datasource.username=recipes +pring.datasource.password=yumyumyum +spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver +#org.sqlite.JDBC #spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect -spring.jpa.database-platform=org.sqlite.hibernate.dialect.SQLiteDialect +spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect +#org.sqlite.hibernate.dialect.SQLiteDialect #spring.jpa.show-sql: true # My special properties diff --git a/pom.xml b/pom.xml index 5e24112..4aa2795 100644 --- a/pom.xml +++ b/pom.xml @@ -108,6 +108,38 @@ javax.el + + + com.twelvemonkeys.imageio + imageio-core + 3.8.1 + + + + + com.twelvemonkeys.imageio + imageio-webp + 3.8.1 + + + + com.twelvemonkeys.servlet + servlet + 3.8.1 + + + + + + + mysql + mysql-connector-java + 8.0.30 + + + org.xerial sqlite-jdbc diff --git a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java index 90e934e..60eaff5 100644 --- a/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java +++ b/src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java @@ -49,6 +49,8 @@ public class SpringPrimeFacesApplication { "com.sun.el.ExpressionFactoryImpl"); servletContext.setInitParameter( "primefaces.UPLOADER", "native"); + + servletContext.addListener("com.twelvemonkeys.servlet.image.IIOProviderContextListener"); } }; } diff --git a/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java b/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java index c9e5b69..265719a 100644 --- a/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java +++ b/src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java @@ -73,7 +73,7 @@ public class Recipe implements Serializable { private Integer rating; @Column(name = "recipe_hash") - private Long recipeHash; + private String recipeHash; @Column(name = "servings") private Double servings; @@ -88,7 +88,7 @@ public class Recipe implements Serializable { private String title; @Column(name = "yield_unit") - private Integer yieldUnit; + private String yieldUnit; @Column(name = "yields") private Double yields; @@ -211,11 +211,11 @@ public class Recipe implements Serializable { this.rating = rating; } - public Long getRecipeHash() { + public String getRecipeHash() { return this.recipeHash; } - public void setRecipeHash(Long recipeHash) { + public void setRecipeHash(String recipeHash) { this.recipeHash = recipeHash; } @@ -251,11 +251,11 @@ public class Recipe implements Serializable { this.title = title; } - public Integer getYieldUnit() { + public String getYieldUnit() { return this.yieldUnit; } - public void setYieldUnit(Integer yieldUnit) { + public void String(String yieldUnit) { this.yieldUnit = yieldUnit; } diff --git a/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml b/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml index a3937f2..72e6a43 100644 --- a/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml +++ b/src/main/resources/META-INF/resources/WEB-INF/faces-config.xml @@ -21,11 +21,11 @@ Global Navigation Navigation - /* + * Go Home home - /main.xhtml + /main diff --git a/src/main/resources/META-INF/resources/detailEdit.xhtml b/src/main/resources/META-INF/resources/detailEdit.xhtml index a0af464..cee26a6 100644 --- a/src/main/resources/META-INF/resources/detailEdit.xhtml +++ b/src/main/resources/META-INF/resources/detailEdit.xhtml @@ -154,7 +154,7 @@ update=":messages picPanel" auto="true" sizeLimit="1000000" - allowTypes="/(\.|\/)(gif|jpe?g|png)$/" + allowTypes="/(\.|\/)(gif|jpe?g|png|webp)$/" /> View Expired. The user session has timed out. Return to main page. - + \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/recipeDetails.xhtml b/src/main/resources/META-INF/resources/recipeDetails.xhtml index aaa6a54..6c32735 100644 --- a/src/main/resources/META-INF/resources/recipeDetails.xhtml +++ b/src/main/resources/META-INF/resources/recipeDetails.xhtml @@ -44,10 +44,11 @@ +