StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.01k stars 1.81k forks source link

Support Hibernate #44633

Closed alberttwong closed 1 week ago

alberttwong commented 7 months ago

Trying to use Java Hibernate ORM.

Using

        "hibernate.driver": "com.mysql.cj.jdbc.Driver",
        "hibernate.dialect": "org.hibernate.dialect.MySQLDialect"

and

angus-activation-2.0.0.jar               debezium-core-2.5.4.Final.jar                  jakarta.persistence-api-3.1.0.jar  mchange-commons-java-0.2.19.jar
antlr4-runtime-4.10.1.jar                hibernate-c3p0-6.2.18.Final.jar                jakarta.transaction-api-2.0.1.jar  mssql-jdbc-12.4.2.jre8.jar
byte-buddy-1.14.7.jar                    hibernate-commons-annotations-6.0.6.Final.jar  jakarta.xml.bind-api-4.0.0.jar     mysql-connector-j-8.0.33.jar
c3p0-0.9.5.5.jar                         hibernate-core-6.2.18.Final.jar                jandex-3.0.5.jar                   postgresql-42.6.1.jar
classmate-1.5.1.jar                      istack-commons-runtime-4.1.1.jar               jaxb-core-4.0.2.jar                txw2-4.0.2.jar
debezium-api-2.5.4.Final.jar             jakarta.activation-api-2.1.0.jar               jaxb-runtime-4.0.2.jar
debezium-connector-jdbc-2.5.4.Final.jar  jakarta.inject-api-2.0.1.jar                   jboss-logging-3.5.0.Final.jar

and it doesn't work.

2024-04-23 14:41:08 2024-04-23 21:41:08,304 INFO   ||  Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ce2da385 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@36cbafb5 [ acquireIncrement -> 32, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, identityToken -> 1bqrg26b33k1jfq147fvfz|41f37382, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 32, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@becd5543 [ description -> null, driverClass -> null, factoryClassLocation -> null, forceUseNamedDriverClass -> false, identityToken -> 1bqrg26b33k1jfq147fvfz|2433dba3, jdbcUrl -> jdbc:mysql://localhost:9030/tpcds, properties -> {password=******, user=******} ], preferredTestQuery -> null, privilegeSpawnedThreads -> false, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, extensions -> {}, factoryClassLocation -> null, identityToken -> 1bqrg26b33k1jfq147fvfz|a1d50b7, numHelperThreads -> 3 ]   [com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource]
2024-04-23 14:41:38 2024-04-23 21:41:38,383 WARN   ||  com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@4b09d386 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:    [com.mchange.v2.resourcepool.BasicResourcePool]
2024-04-23 14:41:38 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
2024-04-23 14:41:38 
2024-04-23 14:41:38 The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2024-04-23 14:41:38     at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:175)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:446)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:239)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:188)
2024-04-23 14:41:38     at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
2024-04-23 14:41:38     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
2024-04-23 14:41:38     at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
2024-04-23 14:41:38     at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
2024-04-23 14:41:38     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1176)
2024-04-23 14:41:38     at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1163)
2024-04-23 14:41:38     at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
2024-04-23 14:41:38     at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1908)
2024-04-23 14:41:38     at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
2024-04-23 14:41:38 Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
2024-04-23 14:41:38 
2024-04-23 14:41:38 The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2024-04-23 14:41:38     at jdk.internal.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source)
2024-04-23 14:41:38     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2024-04-23 14:41:38     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
2024-04-23 14:41:38     at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
2024-04-23 14:41:38     at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
2024-04-23 14:41:38     at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:150)
2024-04-23 14:41:38     at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:166)
2024-04-23 14:41:38     at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
2024-04-23 14:41:38     at com.mysql.cj.NativeSession.connect(NativeSession.java:121)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:945)
2024-04-23 14:41:38     at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:815)
2024-04-23 14:41:38     ... 12 more
2024-04-23 14:41:38 Caused by: java.net.ConnectException: Connection refused (Connection refused)
2024-04-23 14:41:38     at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
2024-04-23 14:41:38     at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
2024-04-23 14:41:38     at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
2024-04-23 14:41:38     at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
2024-04-23 14:41:38     at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
2024-04-23 14:41:38     at java.base/java.net.Socket.connect(Socket.java:609)
2024-04-23 14:41:38     at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153)
2024-04-23 14:41:38     at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
2024-04-23 14:41:38     ... 15 more
alberttwong commented 7 months ago

https://github.com/StarRocks/starrocks-connector-for-kafka/issues/20

alberttwong commented 7 months ago

if I just use hibernate.dialect":"org.hibernate.dialect.MySQLDialect with no driver parameter.

2024-04-23 15:13:16 2024-04-23 22:13:16,087 WARN   ||  HHH000342: Could not obtain connection to query metadata   [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator]
2024-04-23 15:13:16 java.lang.NullPointerException
2024-04-23 15:13:16     at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcIsolationDelegate.delegateWork(JdbcIsolationDelegate.java:116)
2024-04-23 15:13:16     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:279)
2024-04-23 15:13:16     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:193)
2024-04-23 15:13:16     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:69)
2024-04-23 15:13:16     at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
2024-04-23 15:13:16     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:264)
2024-04-23 15:13:16     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:239)
2024-04-23 15:13:16     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:216)
2024-04-23 15:13:16     at org.hibernate.boot.model.relational.Database.<init>(Database.java:45)
2024-04-23 15:13:16     at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:231)
2024-04-23 15:13:16     at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:199)
2024-04-23 15:13:16     at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:169)
2024-04-23 15:13:16     at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:128)
2024-04-23 15:13:16     at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:451)
2024-04-23 15:13:16     at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:102)
2024-04-23 15:13:16     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:910)
2024-04-23 15:13:16     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:960)
2024-04-23 15:13:16     at io.debezium.connector.jdbc.JdbcSinkConnectorTask.start(JdbcSinkConnectorTask.java:75)
2024-04-23 15:13:16     at org.apache.kafka.connect.runtime.WorkerSinkTask.initializeAndStart(WorkerSinkTask.java:329)
2024-04-23 15:13:16     at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:202)
2024-04-23 15:13:16     at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:259)
2024-04-23 15:13:16     at org.apache.kafka.connect.runtime.isolation.Plugins.lambda$withClassLoader$1(Plugins.java:236)
2024-04-23 15:13:16     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2024-04-23 15:13:16     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2024-04-23 15:13:16     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2024-04-23 15:13:16     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2024-04-23 15:13:16     at java.base/java.lang.Thread.run(Thread.java:829)
alberttwong commented 7 months ago

MariaDBDialect doesn't work

alberttwong commented 7 months ago
2024-04-23 15:29:34 org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')
2024-04-23 15:29:34     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:277)
2024-04-23 15:29:34     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:239)
2024-04-23 15:29:34     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:216)
2024-04-23 15:29:34     at org.hibernate.boot.model.relational.Database.<init>(Database.java:45)
2024-04-23 15:29:34     at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:231)
2024-04-23 15:29:34     at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:199)
2024-04-23 15:29:34     at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:169)
2024-04-23 15:29:34     at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:128)
2024-04-23 15:29:34     at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:451)
2024-04-23 15:29:34     at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:102)
2024-04-23 15:29:34     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:910)
2024-04-23 15:29:34     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:960)
2024-04-23 15:29:34     at io.debezium.connector.jdbc.JdbcSinkConnectorTask.start(JdbcSinkConnectorTask.java:75)
2024-04-23 15:29:34     at org.apache.kafka.connect.runtime.WorkerSinkTask.initializeAndStart(WorkerSinkTask.java:329)
2024-04-23 15:29:34     at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:202)
2024-04-23 15:29:34     at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:259)
2024-04-23 15:29:34     at org.apache.kafka.connect.runtime.isolation.Plugins.lambda$withClassLoader$1(Plugins.java:236)
2024-04-23 15:29:34     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
2024-04-23 15:29:34     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
2024-04-23 15:29:34     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2024-04-23 15:29:34     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2024-04-23 15:29:34     at java.base/java.lang.Thread.run(Thread.java:829)
2024-04-23 15:29:34 Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect')
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:190)
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:86)
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentWithDefaults(JdbcEnvironmentInitiator.java:229)
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:381)
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:193)
2024-04-23 15:29:34     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:69)
2024-04-23 15:29:34     at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
2024-04-23 15:29:34     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:264)
2024-04-23 15:29:34     ... 21 more
alberttwong commented 7 months ago

https://discourse.hibernate.org/t/unable-to-determine-dialect-without-jdbc-metadata/9414

alberttwong commented 6 months ago

https://github.com/StarRocks/starrocks/issues/44849

github-actions[bot] commented 3 weeks ago

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!