Skip to content

Commit

Permalink
Fix: SQL Dialect (#213)
Browse files Browse the repository at this point in the history
* Remove explicit SQL Dialect

* Add Hibernate Datatype to ensure compatibility with MySQL

* Update Commons-FileUpload Dependency
  • Loading branch information
f11h authored Feb 22, 2023
1 parent a54df09 commit 7856404
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<exclusions>
<exclusion>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Explicit inclusion because of CVE-2023-24998 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import java.time.ZonedDateTime;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcType;
import org.hibernate.type.descriptor.jdbc.LongVarcharJdbcType;

@Getter
@Setter
Expand Down Expand Up @@ -97,7 +98,7 @@ public class RevocationBatchEntity {
* The Signed CMS with the batch.
*/
@Column(name = "signed_batch", length = 1_024_000)
@Lob
@JdbcType(LongVarcharJdbcType.class)
private String signedBatch;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.JdbcType;
import org.hibernate.type.descriptor.jdbc.LongVarcharJdbcType;

@Getter
@Setter
Expand All @@ -46,7 +47,7 @@ public class ValuesetEntity {
* Signature of the TrustAnchor.
*/
@Column(name = "json", nullable = false, length = 1024000)
@Lob
@JdbcType(LongVarcharJdbcType.class)
String json;

}
3 changes: 2 additions & 1 deletion src/main/resources/application-h2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ spring:
username: sa
password: ''
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: none
2 changes: 0 additions & 2 deletions src/main/resources/application-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ spring:
password: sa # do not use this for production deployments
driver-class-name: com.mysql.cj.jdbc.Driver
jndi-name: false
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spring:
datasource:
jndi-name: jdbc/dgc
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate:
ddl-auto: validate
liquibase:
Expand Down

0 comments on commit 7856404

Please sign in to comment.