<commit_before># Google Cloud Spanner Dialect for Hibernate ORM

http://github.com/badges/stability-badges[image:http://badges.github.io/stability-badges/dist/experimental.svg[experimental]]

This is a dialect compatible with https://hibernate.org/orm/releases/5.4/[Hibernate 5.4] for the https://cloud.google.com/spanner/[Google Cloud Spanner] database service.
The `SpannerDialect` produces SQL, DML, and DDL statements for most common entity types and relationships using standard Hibernate and Java Persistence annotations.

Please see the following sections for important details about dialect differences due to the unique features and limitations of Cloud Spanner.

=== Quick Set-Up

Maven coordinates for the dialect:

[source,xml]
----
<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-spanner-hibernate-dialect</artifactId>
  <version> TBD </version>
</dependency>
----

Maven coordinates for the official open source Cloud Spanner JDBC Driver:

[source,xml]
----
<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-spanner-jdbc</artifactId>
  <version>0.1.0</version>
</dependency>
----

Configuring the `SpannerDialect` and a Cloud Spanner Driver class is typical of all Hibernate dialects in the `hibernate.properties` file:

----
hibernate.dialect=com.google.cloud.spanner.hibernate.SpannerDialect
hibernate.connection.driver_class=com.google.cloud.spanner.jdbc.JdbcDriver
hibernate.connection.url=jdbc:cloudspanner:/projects/{INSERT_PROJECT_ID}/instances/{INSERT_INSTANCE_ID}/databases/{INSERT_DATABASE_ID}
----

The https://cloud.google.com/docs/authentication/getting-started[service account JSON credentials] file location should be in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.<commit_msg>Mention lack of support for Simba driver (#116)<commit_after># Google Cloud Spanner Dialect for Hibernate ORM

http://github.com/badges/stability-badges[image:http://badges.github.io/stability-badges/dist/experimental.svg[experimental]]

This is a dialect compatible with https://hibernate.org/orm/releases/5.4/[Hibernate 5.4] for the https://cloud.google.com/spanner/[Google Cloud Spanner] database service.
The `SpannerDialect` produces SQL, DML, and DDL statements for most common entity types and relationships using standard Hibernate and Java Persistence annotations.

Please see the following sections for important details about dialect differences due to the unique features and limitations of Cloud Spanner.

=== Quick Set-Up

Maven coordinates for the dialect:

[source,xml]
----
<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-spanner-hibernate-dialect</artifactId>
  <version> TBD </version>
</dependency>
----

Maven coordinates for the official https://cloud.google.com/spanner/docs/open-source-jdbc[open source Cloud Spanner JDBC Driver].

[source,xml]
----
<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-spanner-jdbc</artifactId>
  <version>0.1.0</version>
</dependency>
----

NOTE: Hibernate ORM with Cloud Spanner is officially supported only with the https://cloud.google.com/spanner/docs/open-source-jdbc[open source Cloud Spanner JDBC Driver]. It does not support the https://cloud.google.com/spanner/docs/partners/drivers[Simba JDBC driver] at this time.

Configuring the `SpannerDialect` and a Cloud Spanner Driver class is typical of all Hibernate dialects in the `hibernate.properties` file:

----
hibernate.dialect=com.google.cloud.spanner.hibernate.SpannerDialect
hibernate.connection.driver_class=com.google.cloud.spanner.jdbc.JdbcDriver
hibernate.connection.url=jdbc:cloudspanner:/projects/{INSERT_PROJECT_ID}/instances/{INSERT_INSTANCE_ID}/databases/{INSERT_DATABASE_ID}
----

The https://cloud.google.com/docs/authentication/getting-started[service account JSON credentials] file location should be in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
{'fraction_non_alphanumeric': 0.10964131264309336, 'fraction_numerical': 0.0043245993385906895, 'mean_word_length': 5.39349593495935, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3889859', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1114, 'n_words': 305}