Update to Hibernate 6.

This commit is contained in:
Kavin 2022-06-17 16:37:10 +01:00
parent 047fd18f21
commit c23805288f
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
13 changed files with 54 additions and 68 deletions

View File

@ -33,8 +33,8 @@ dependencies {
implementation 'io.activej:activej-launchers-http:5.2'
implementation 'org.hsqldb:hsqldb:2.6.1'
implementation 'org.postgresql:postgresql:42.4.0'
implementation 'org.hibernate:hibernate-core:5.6.7.Final'
implementation 'org.hibernate:hibernate-hikaricp:5.6.7.Final'
implementation 'org.hibernate:hibernate-core:6.1.0.Final'
implementation 'org.hibernate:hibernate-hikaricp:6.1.0.Final'
implementation 'com.zaxxer:HikariCP:5.0.1'
implementation 'org.springframework.security:spring-security-crypto:5.7.1'
implementation 'commons-logging:commons-logging:1.2'

View File

@ -1,37 +1,27 @@
# The port to Listen on.
PORT: 8080
PORT:8080
# The number of workers to use for the server
HTTP_WORKERS: 2
HTTP_WORKERS:2
# Proxy
PROXY_PART: https://pipedproxy-ams.kavin.rocks
PROXY_PART:https://pipedproxy-ams.kavin.rocks
# Outgoing HTTP Proxy - eg: 127.0.0.1:8118
#HTTP_PROXY: 127.0.0.1:8118
# Captcha Parameters
CAPTCHA_BASE_URL: https://api.capmonster.cloud/
CAPTCHA_API_KEY: INSERT_HERE
CAPTCHA_BASE_URL:https://api.capmonster.cloud/
CAPTCHA_API_KEY:INSERT_HERE
# Public API URL
API_URL: https://pipedapi.kavin.rocks
API_URL:https://pipedapi.kavin.rocks
# Public Frontend URL
FRONTEND_URL: https://piped.kavin.rocks
FRONTEND_URL:https://piped.kavin.rocks
# Enable haveibeenpwned compromised password API
COMPROMISED_PASSWORD_CHECK: true
COMPROMISED_PASSWORD_CHECK:true
# Disable Registration
DISABLE_REGISTRATION: false
DISABLE_REGISTRATION:false
# Feed Retention Time in Days
FEED_RETENTION: 30
FEED_RETENTION:30
# Hibernate properties
hibernate.connection.url: jdbc:postgresql://postgres:5432/piped
hibernate.connection.driver_class: org.postgresql.Driver
hibernate.dialect: org.hibernate.dialect.PostgreSQL10Dialect
hibernate.connection.username: piped
hibernate.connection.password: changeme
hibernate.connection.url:jdbc:postgresql://postgres:5432/piped
hibernate.connection.driver_class:org.postgresql.Driver
hibernate.dialect:org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.username:piped
hibernate.connection.password:changeme

View File

@ -1,6 +1,8 @@
package me.kavin.piped;
import io.activej.inject.Injector;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import me.kavin.piped.consts.Constants;
import me.kavin.piped.utils.DatabaseSessionFactory;
import me.kavin.piped.utils.DownloaderImpl;
@ -16,8 +18,6 @@ import org.schabi.newpipe.extractor.localization.Localization;
import org.schabi.newpipe.extractor.services.youtube.YoutubeThrottlingDecrypter;
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import java.util.*;
import java.util.concurrent.TimeUnit;

View File

@ -81,6 +81,13 @@ public class Constants {
if (key.startsWith("hibernate"))
hibernateProperties.put(key, value);
});
// transform hibernate properties for legacy configureations
hibernateProperties.replace("hibernate.dialect",
"org.hibernate.dialect.PostgreSQL10Dialect",
"org.hibernate.dialect.PostgreSQLDialect"
);
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.followRedirects(true)
.addInterceptor(BrotliInterceptor.INSTANCE);

View File

@ -1,13 +1,13 @@
package me.kavin.piped.utils;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.JoinType;
import jakarta.persistence.criteria.Root;
import me.kavin.piped.utils.obj.db.*;
import org.hibernate.FlushMode;
import org.hibernate.Session;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Root;
import java.util.List;
import java.util.UUID;

View File

@ -8,6 +8,10 @@ import com.rometools.rome.feed.synd.*;
import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.SyndFeedOutput;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.JoinType;
import jakarta.persistence.criteria.Root;
import me.kavin.piped.consts.Constants;
import me.kavin.piped.ipfs.IPFS;
import me.kavin.piped.utils.obj.*;
@ -46,10 +50,6 @@ import org.schabi.newpipe.extractor.utils.JsonUtils;
import org.springframework.security.crypto.argon2.Argon2PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Root;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;

View File

@ -1,10 +1,6 @@
package me.kavin.piped.utils.obj.db;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import jakarta.persistence.*;
@Entity
@Table(name = "channels", indexes = {@Index(columnList = "uploader_id", name = "channels_uploader_id_idx")})

View File

@ -1,8 +1,8 @@
package me.kavin.piped.utils.obj.db;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import jakarta.persistence.*;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;

View File

@ -1,6 +1,6 @@
package me.kavin.piped.utils.obj.db;
import javax.persistence.*;
import jakarta.persistence.*;
@Entity
@Table(name = "playlist_videos", indexes = {@Index(columnList = "id", name = "playlist_videos_id_idx"),

View File

@ -1,14 +1,10 @@
package me.kavin.piped.utils.obj.db;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import jakarta.persistence.*;
@Entity
@Table(name = "pubsub", indexes = { @Index(columnList = "id", name = "pubsub_id_idx"),
@Index(columnList = "subbed_at", name = "pubsub_subbed_at_idx") })
@Table(name = "pubsub", indexes = {@Index(columnList = "id", name = "pubsub_id_idx"),
@Index(columnList = "subbed_at", name = "pubsub_subbed_at_idx")})
public class PubSub {
@Id

View File

@ -1,6 +1,7 @@
package me.kavin.piped.utils.obj.db;
import javax.persistence.*;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Set;
import java.util.UUID;

View File

@ -1,11 +1,11 @@
package me.kavin.piped.utils.obj.db;
import javax.persistence.*;
import jakarta.persistence.*;
@Entity
@Table(name = "videos", indexes = { @Index(columnList = "id", name = "videos_id_idx"),
@Table(name = "videos", indexes = {@Index(columnList = "id", name = "videos_id_idx"),
@Index(columnList = "uploader_id", name = "video_uploader_id_idx"),
@Index(columnList = "uploaded", name = "video_uploaded_idx") })
@Index(columnList = "uploaded", name = "video_uploaded_idx")})
public class Video {
@Id

View File

@ -1,18 +1,14 @@
# The port to Listen on.
PORT: 8080
PORT:8080
# Proxy
PROXY_PART: https://pipedproxy-ams.kavin.rocks
PROXY_PART:https://pipedproxy-ams.kavin.rocks
# Public API URL
API_URL: https://pipedapi.kavin.rocks
API_URL:https://pipedapi.kavin.rocks
# Public Frontend URL
FRONTEND_URL: https://piped.kavin.rocks
FRONTEND_URL:https://piped.kavin.rocks
# Hibernate properties
hibernate.connection.url: jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable
hibernate.connection.driver_class: org.postgresql.Driver
hibernate.dialect: org.hibernate.dialect.CockroachDB201Dialect
hibernate.connection.username: root
hibernate.connection.password: root
hibernate.connection.url:jdbc:postgresql://cockroachdb:26257/defaultdb?sslmode=disable
hibernate.connection.driver_class:org.postgresql.Driver
hibernate.dialect:org.hibernate.dialect.CockroachDialect
hibernate.connection.username:root
hibernate.connection.password:root