spanner-hibernate | Hibernate Dialect for Google Cloud Spanner | GCP library
kandi X-RAY | spanner-hibernate Summary
kandi X-RAY | spanner-hibernate Summary
Hibernate Dialect for Google Cloud Spanner
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Overrides the default implementation to drop the table and indices
- Get the names of all indexes including primary key
- Check if a table exists
- Returns the command to drop the specified unique key
- Initializes the indexes
- Get database meta data
- Invokes the given method on the delegate
- Adds a set of auxiliary database objects to the given database
- Gets the cast type name
- Returns the type name without scale
- Returns the SQL table to add a new unique key to the table
- Overrides the default implementation of the IdentifierHelper
- Get a SchemaCreator from the Cloud Spanner schema
- Get a schema drop down the class loader
- Gets the schema migration
spanner-hibernate Key Features
spanner-hibernate Examples and Code Snippets
Community Discussions
Trending Discussions on spanner-hibernate
QUESTION
I am trying to run a basic spring boot application with JPA by using spanner emulator. However, I am getting the below error after startup after hitting any exposed end point.
PERMISSION_DENIED: com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Caller is missing IAM permission spanner.sessions.create on resource projects/test-project/instances/test-instance/databases/test-database.
Project has been cloned from https://github.com/GoogleCloudPlatform/google-cloud-spanner-hibernate/tree/master/google-cloud-spanner-hibernate-samples/spring-data-jpa-sample and the only change I have done is updated the application.properties file. as per my understanding spanner emulator should not have any IAM related issues as it doesn't need any. I am not sure what is causing this issue here. I have verified that the emulator config is the active config and hence I would expect the code to connect to emulator.
...ANSWER
Answered 2021-Oct-06 at 13:53The error is a clear indication that your application is not trying to connect to the emulator, but to a real Spanner database. In order to connect to the emulator instead of 'real' Cloud Spanner, you should do one of the following:
- Set the environment variable
SPANNER_EMULATOR_HOST=localhost:9010
- OR: Edit the JDBC connection URL to include the
autoConfigEmulator=true
property. Your JDBC URL would then becomejdbc:cloudspanner:/projects/test-project/instances/test-instance/databases/test-database;autoConfigEmulator=true
The advantage of the second alternative is that the autoConfigEmulator
property will not only ensure that the JDBC driver is connecting to the emulator, it will also automatically create the test-instance
and test-database
on the emulator if they do not already exist.
QUESTION
I am attempting to migrate an existing spring boot application from using Postgres to GCP Spanner.
I am using the following Cloud Spanner JDBC driver and Hibernate dialect:
...ANSWER
Answered 2020-Mar-25 at 17:09It should work out of the box and I can't see anything directly wrong in the settings that you have provided. So my guess is that there is something additional here that is causing the problem (dependency, other setting etc.). You are using somewhat older versions of the Hibernate dialect and the JDBC driver, but that should not be the problem.
One possible problem could be that your system is not set up with default Google Cloud credentials. I noticed that your JDBC URL does not contain any credentials, which means that it will fallback to the default of the environment. I would expect an error if it could not find any, but it could be a possible cause of problems.
I've created a very simple test project with Spring boot and tried it out, and it does work. Could you try with this simple test setup as well and try to add from there to figure out where it goes wrong? Or otherwise give some more details on any additional dependencies that you may be including in your project?
My setup that works:
pom.xml
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spanner-hibernate
You can use spanner-hibernate like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spanner-hibernate component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page