<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ContactUsPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="none" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<!-- <property name="hibernate.connection.url" value="jdbc:mysql://localhost/bbholidays" /> -->
<property name="hibernate.connection.url"
value="jdbc:mysql://google/bbh_database?cloudSqlInstance=bbhwebapp:asia-southeast1:bbh-db&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false"/>
<property name="hibernate.connection.username" value="xxxxx" />
<property name="hibernate.connection.password" value="xxxxx" />
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.use_sql_comments" value="true" />
<property name="hbm2ddl.auto" value="none" />
<property name="hibernate.connection.autocommit" value="true"/>
</properties>
</persistence-unit>
</persistence>
I would recommend providing more details about your implementation and providing full errors logs. It will also be useful to know which documentation you used to set up your connection between Cloud SQL and JPA + Hibernate. This github sample provide more details on how to connect to Cloud SQL with Hibernate.