Migrated to MySQL and found some JPA sloppiness in sqlite's field

definitions. Prepping to use ImageIO for "webp" images.
version2
Tim Holloway 2 years ago
parent 8de1e20a2a
commit 94cabeb695
  1. 15
      application.properties
  2. 32
      pom.xml
  3. 2
      src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java
  4. 12
      src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java
  5. 4
      src/main/resources/META-INF/resources/WEB-INF/faces-config.xml
  6. 2
      src/main/resources/META-INF/resources/detailEdit.xhtml
  7. 2
      src/main/resources/META-INF/resources/error/viewExpired.xhtml
  8. 3
      src/main/resources/META-INF/resources/recipeDetails.xhtml
  9. 10
      src/main/resources/application.yml

@ -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

@ -108,6 +108,38 @@
<artifactId>javax.el</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-core -->
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-core</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-webp -->
<!-- In Core??? -->
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-webp</artifactId>
<version>3.8.1</version>
</dependency>
<!-- Needed only if you deploy ImageIO plugins as part of a web app.
Make sure you add the IIOProviderContextListener to your web.xml.
-->
<dependency>
<groupId>com.twelvemonkeys.servlet</groupId>
<artifactId>servlet</artifactId>
<version>3.8.1</version>
</dependency>
<!-- MySQL DB -->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
</dependency>
<!-- SQLite DB -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>

@ -49,6 +49,8 @@ public class SpringPrimeFacesApplication {
"com.sun.el.ExpressionFactoryImpl");
servletContext.setInitParameter(
"primefaces.UPLOADER", "native");
servletContext.addListener("com.twelvemonkeys.servlet.image.IIOProviderContextListener");
}
};
}

@ -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;
}

@ -21,11 +21,11 @@
<navigation-rule>
<description>Global Navigation</description>
<display-name>Navigation</display-name>
<from-view-id>/*</from-view-id>
<from-view-id>*</from-view-id>
<navigation-case>
<description>Go Home</description>
<from-outcome>home</from-outcome>
<to-view-id>/main.xhtml</to-view-id>
<to-view-id>/main</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>

@ -154,7 +154,7 @@
update=":messages picPanel"
auto="true"
sizeLimit="1000000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
allowTypes="/(\.|\/)(gif|jpe?g|png|webp)$/"
/>
<p:commandButton id="ctlDelImg"
value="Delete Image"

@ -11,7 +11,7 @@
<h2>View Expired.</h2>
<h:form>
The user session has timed out. Return to main page.
<h:commandButton value="OK" action="/main.jsf"></h:commandButton>
<h:commandButton value="OK" action="home"></h:commandButton>
</h:form>
</h:body>
</html>

@ -44,10 +44,11 @@
<p:panelGrid id="pnlDetails"
columns="2"
>
<!-- TODO: ask if we should save -->
<p:commandButton value="Back"
ajax="false"
icon="ui-icon-arrowthick-1-w"
action="main.jsf"
action="home"
immediate="true"
/>
<p:commandButton ajax="false"

@ -4,11 +4,17 @@
#
spring:
datasource:
url: jdbc:sqlite:${home}/recipes.db
#url: jdbc:sqlite:${home}/recipes.db
url: jdbc:mysql:dbase/recipes
# options: ${env} values
driverClassName: ork.mysql.jdbc.Driver
username: recipes
password: yumyumyum
jpa:
hibernate:
ddl-auto: none
database-platform: org.sqlite.hibernate.dialect.SQLiteDialect
#database-platform: org.sqlite.hibernate.dialect.SQLiteDialect
database-platform: org.hibernate.dialect.MySQLDialect
gourmet:
password:

Loading…
Cancel
Save