Skip to content

Feature/update hibernate 6 #7381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

JoeWang1127
Copy link
Contributor

@JoeWang1127 JoeWang1127 commented Nov 2, 2022

Fixes #7318

It's a good idea to open an issue first for discussion.

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • API's need to be enabled to test (tell us)
  • Environment Variables need to be set (ask us to set them)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • Please merge this PR for me once it is approved.

@JoeWang1127 JoeWang1127 requested review from a team and yoshi-approver as code owners November 2, 2022 21:02
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Nov 2, 2022
kolea2
kolea2 previously requested changes Nov 3, 2022
@@ -6,13 +6,13 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add some context in the PR description around why we're upgrading this to Java 11, and why we're removing the spanner dependency? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hibernate 6 requires Java 11, see here.

Also, spanner dialect has been moved inside hibernate package, i.e., org.hibernate.dialect.SpannerDialect.

@JoeWang1127 JoeWang1127 requested a review from kolea2 November 3, 2022 17:53
@kweinmeister kweinmeister added the api: spanner Issues related to the Spanner API. label Dec 3, 2022
@JoeWang1127
Copy link
Contributor Author

Hi @kweinmeister, do we still need this PR?

@averikitsch averikitsch dismissed kolea2’s stale review December 7, 2022 19:35

Version update is needed for new features

@averikitsch
Copy link
Contributor

@JoeWang1127 Has this been tested since there is no automated tests?

@JoeWang1127
Copy link
Contributor Author

JoeWang1127 commented Dec 7, 2022

@JoeWang1127 Has this been tested since there is no automated tests?

Hi @averikitsch, I tested the sample on my local environment and it worked as expected.

This is the output, you can find the hibernate version and dialect are updated

Dec. 07, 2022 4:28:46 P.M. org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 6.1.5.Final
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using built-in connection pool (not intended for production use)
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: Loaded JDBC driver class: com.google.cloud.spanner.jdbc.JdbcDriver
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001012: Connecting with JDBC URL [jdbc:cloudspanner:/projects/joe-experimental-project/instances/demo-spanner/databases/standard-db]
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {}
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Dec. 07, 2022 4:28:46 P.M. org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH10001115: Connection pool size: 20 (min=1)
Dec. 07, 2022 4:28:46 P.M. com.google.auth.oauth2.DefaultCredentialsProvider warnAboutProblematicCredentials
INFO: HHH000400: Using dialect: org.hibernate.dialect.SpannerDialect
Hibernate: create table HT_Payment(id string(36) not null, hib_sess_id string(36) not null, primary key (id, hib_sess_id))
Hibernate: create table HTE_Payment(id string(36) not null, amount int64, credit_card_id string(255), wire_id string(255), hib_sess_id string(36) not null, primary key (id, hib_sess_id))
Hibernate: create table HTE_WireTransferPayment(id string(36) not null, amount int64, wire_id string(255), hib_sess_id string(36) not null, primary key (id, hib_sess_id))
Hibernate: create table HTE_CreditCardPayment(id string(36) not null, amount int64, credit_card_id string(255), hib_sess_id string(36) not null, primary key (id, hib_sess_id))
Dec. 07, 2022 4:28:50 P.M. org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@29fd5adb] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
Hibernate: create table CreditCardPayment (credit_card_id string(255),id string(36) not null) PRIMARY KEY (id)
Hibernate: create table Payment (id string(36) not null,amount int64) PRIMARY KEY (id)
Hibernate: create table PersonsTable (id string(36) not null,address string(255),name string(255),nickname string(255)) PRIMARY KEY (id)
Hibernate: create table PersonsTable_Payment (Person_id string(36) not null,payments_id string(36) not null) PRIMARY KEY (Person_id,payments_id)
Hibernate: create table WireTransferPayment (wire_id string(255),id string(36) not null) PRIMARY KEY (id)
Dec. 07, 2022 4:30:24 P.M. org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService
INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
Hibernate: insert into PersonsTable (address, name, nickname, id) values (?, ?, ?, ?)
Hibernate: insert into Payment (amount, id) values (?, ?)
Hibernate: insert into WireTransferPayment (wire_id, id) values (?, ?)
Hibernate: insert into Payment (amount, id) values (?, ?)
Hibernate: insert into CreditCardPayment (credit_card_id, id) values (?, ?)
Hibernate: insert into PersonsTable_Payment (Person_id, payments_id) values (?, ?)
Hibernate: insert into PersonsTable_Payment (Person_id, payments_id) values (?, ?)
Hibernate: select p1_0.id,p1_0.address,p1_0.name,p1_0.nickname from PersonsTable p1_0
There are 1 persons saved in the table:
Person{
 id=dd3b3dbc-af16-44db-a2c8-0b072d0ccae7
 name='person'
 nickname='purson'
 address='address'
 total_payments=800
}

@JoeWang1127 JoeWang1127 merged commit 5cbe5b1 into GoogleCloudPlatform:main Dec 8, 2022
@kweinmeister
Copy link
Contributor

Thank you @JoeWang1127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update org.hibernate:hibernate-core to v6
4 participants