Closed k1ll1n closed 3 months ago
Is a the driver the issue? The HikariModule set up pool class name to oracle.jdbc.pool.OracleDataSource
Don't seem to be a Jooby issue.
I tried to make a manual connection, and it has no problems.
public class HibernateUtil {
private static SessionFactory sessionFactory;
public static SessionFactory getSessionFactory() {
if (sessionFactory == null) {
StandardServiceRegistry standardRegistry = new StandardServiceRegistryBuilder()
.applySettings(getConfigurationProperties())
.build();
try {
Metadata metadata = new MetadataSources(standardRegistry)
.addAnnotatedClass(Test.class)
.buildMetadata();
sessionFactory = metadata.getSessionFactoryBuilder().build();
} catch (Exception e) {
System.err.println("Error create SessionFactory: " + e);
if (standardRegistry != null) {
StandardServiceRegistryBuilder.destroy(standardRegistry);
}
}
}
return sessionFactory;
}
private static Properties getConfigurationProperties() {
Properties properties = new Properties();
properties.put(Environment.DRIVER, "oracle.jdbc.driver.OracleDriver");
properties.put(Environment.URL, "jdbc:oracle:thin:@domain.com:1521:PHX");
properties.put(Environment.USER, "USER");
properties.put(Environment.PASS, "PASSWORD");
properties.put(Environment.DIALECT, "org.hibernate.dialect.OracleDialect");
properties.put(Environment.SHOW_SQL, "true");
properties.put(Environment.FORMAT_SQL, "true");
properties.put(Environment.HBM2DDL_AUTO, "validate");
return properties;
}
public static void shutdown() {
if (sessionFactory != null) {
sessionFactory.close();
}
}
}
But when I use "HibernateModule" and "HikariModule" for connection, I get the problem described above. And it appears at the server startup, I do not even open any page.
Unfortunately, I can’t find a solution to the problem on my own, so I came to ask you for help.
and my gradle
buildscript {
ext {
joobyVersion = System.getProperty("joobyVersion")
}
}
plugins {
id "application"
id "io.jooby.run" version "${joobyVersion}"
id "io.spring.dependency-management" version "1.1.0"
id "com.google.osdetector" version "1.7.3"
id "com.github.johnrengelman.shadow" version "8.1.1"
}
group "com.test"
version "1.0.0"
mainClassName = "com.test.App"
sourceCompatibility = 21
repositories {
mavenLocal()
mavenCentral()
}
dependencyManagement {
imports {
mavenBom "io.jooby:jooby-bom:$joobyVersion"
}
}
dependencies {
implementation "io.jooby:jooby-netty"
implementation "io.jooby:jooby-logback"
implementation "io.jooby:jooby-guice"
annotationProcessor "io.jooby:jooby-apt"
implementation 'org.reflections:reflections:0.10.2'
implementation 'io.jooby:jooby-hikari:3.1.2'
implementation 'io.jooby:jooby-hibernate:3.1.2'
implementation 'com.oracle.database.jdbc:ojdbc10:19.23.0.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.10.2"
testImplementation "io.jooby:jooby-test"
testImplementation "com.squareup.okhttp3:okhttp:4.12.0"
}
test {
useJUnitPlatform()
}
/** Java debug information: */
tasks.withType(JavaCompile) {
options.compilerArgs += [
'-parameters',
]
options.debug = true
}
shadowJar {
mergeServiceFiles()
}
joobyRun {
mainClass = mainClassName
restartExtensions = ["conf", "properties", "class"]
compileExtensions = ["java"]
port = 8080
}
Odd. Is there way to bootstrap an oracle db with Docker? Never used Oracle :S
Odd. Is there way to bootstrap an oracle db with Docker? Never used Oracle :S
Hello, unfortunately there is no such possibility. And you also have no ideas on how to solve my problem?
ORA-01441: cannot decrease column length because some value is too big
Seems to be a schema/datatype issue, but I can't reproduce it to be 100% sure
ORA-01441: cannot decrease column length because some value is too big
Above error will produce when you are trying to modify the column to one value, and that column contains data, whose length is more than setting value, then it will throw error.
So, the only solution is to find the row-column values whose length is more that setting value and modify the data to a small value.
I'm trying to connect Hibernate to Oracle database. My config
My App
My Controller
My log
And then a mistake