Skip to content

Conversation

@ericharmeling
Copy link
Contributor

@ericharmeling ericharmeling commented Jul 30, 2020

Related to #5992.

  • Updated 19.2, 20.1, and 20.2 Hibernate example code to use the CockroachDB Hibernate dialect.
  • Updated 19.2, 20.1, and 20.2 install instructions for Hibernate.

I've also updated hello-world-java-hibernate to use CockroachDB Hibernate dialect (see cockroachlabs/example-app-java-hibernate@ef4178a).

Note that this PR does not include updates to the Spring JPA example code. Those doc updates depend on a PR to the roach-data repo, so I've made them in a separate PR (#7918).

@ericharmeling ericharmeling requested a review from rafiss July 30, 2020 20:39
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroach-teamcity
Copy link
Member

@ericharmeling ericharmeling force-pushed the crdb-hibernate-dialect branch from 1013e33 to 806100a Compare August 4, 2020 17:49
@ericharmeling ericharmeling force-pushed the crdb-hibernate-dialect branch from 806100a to 6ca209b Compare August 4, 2020 18:21
1. Download and extract [hibernate-basic-sample.tgz](https://github.com/cockroachdb/docs/raw/master/_includes/{{ page.version.version }}/app/hibernate-basic-sample/hibernate-basic-sample.tgz). The settings in [`hibernate.cfg.xml`](https://github.com/cockroachdb/docs/raw/master/_includes/{{ page.version.version }}/app/hibernate-basic-sample/hibernate.cfg.xml) specify how to connect to the database.

{{site.data.alerts.callout_info}}
The version of the CockroachDB Hibernate dialect in `hibernate.cfg.xml` corresponds to a version of CockroachDB. To enable all features available in your version of CockroachDB, we recommend keeping the dialect version in sync with the installed version of CockroachDB. The dialect version must be no greater than the installed version of CockroachDB, but using a previous version of the CockroachDB dialect will not break an application.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a version matrix to clear up the confusion here?

@ericharmeling ericharmeling requested a review from vy-ton August 10, 2020 11:46
Copy link
Contributor Author

@ericharmeling ericharmeling left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @vy-ton)


v19.2/build-a-java-app-with-cockroachdb-hibernate.md, line 90 at r1 (raw file):

Previously, vy-ton (Vy Ton) wrote…

Should we add a version matrix to clear up the confusion here?

I don't know if that will help in a note here, to be honest. I'm going to link to install-client-drivers.html, which has more detailed information. Please review the updates in the latest commit.

You will also need to specify the CockroachDB dialect in your [Hibernate configuration file](https://www.tutorialspoint.com/hibernate/hibernate_configuration.htm). Versions of the Hibernate CockroachDB dialect correspond to the version of CockroachDB installed on your machine. For example, `org.hibernate.dialect.CockroachDB201Dialect` corresponds to CockroachDB v20.1, and `org.hibernate.dialect.CockroachDB192Dialect` corresponds to CockroachDB v19.2.

For other ways to install Gradle, see [its official documentation](https://gradle.org/install).
All dialect versions are forward-compatible (e.g. CockroachDB v20.1 is compatible with `CockroachDB192Dialect`). In the event of a CockroachDB version upgrade, using a previous version of the CockroachDB dialect will not break an application, but, to enable all features available in your version of CockroachDB, we recommend keeping the dialect version in sync with the installed version of CockroachDB.
Copy link
Contributor

Choose a reason for hiding this comment

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

@ericharmeling Thoughts on below clarification, based on this thread

All dialect versions are forward-compatible (e.g. CockroachDB v20.1 is compatible with `CockroachDB192Dialect`) assuming your application is unaffected by any backward-incompatible changes found in [release notes](https://www.cockroachlabs.com/docs/releases)

Copy link
Contributor

@vy-ton vy-ton left a comment

Choose a reason for hiding this comment

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

Just one comment to provide more detail

@ericharmeling ericharmeling force-pushed the crdb-hibernate-dialect branch from b349298 to 819d700 Compare August 12, 2020 17:05
@ericharmeling ericharmeling requested a review from vy-ton August 12, 2020 17:06
Copy link
Contributor Author

@ericharmeling ericharmeling left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @vy-ton)


v19.2/install-client-drivers.md, line 174 at r2 (raw file):

Previously, vy-ton (Vy Ton) wrote…

@ericharmeling Thoughts on below clarification, based on this thread

All dialect versions are forward-compatible (e.g. CockroachDB v20.1 is compatible with `CockroachDB192Dialect`) assuming your application is unaffected by any backward-incompatible changes found in [release notes](https://www.cockroachlabs.com/docs/releases)

Done.

@ericharmeling ericharmeling requested a review from lnhsingh August 12, 2020 17:06
@ericharmeling ericharmeling force-pushed the crdb-hibernate-dialect branch from 819d700 to cd793ed Compare August 13, 2020 13:32
@ericharmeling ericharmeling force-pushed the crdb-hibernate-dialect branch from cd793ed to 7879639 Compare August 13, 2020 13:34
@ericharmeling ericharmeling merged commit 61840fa into master Aug 13, 2020
@ericharmeling ericharmeling deleted the crdb-hibernate-dialect branch August 24, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants