问题
how to configure hibernate.cfg.xml for accessing cloud sql as well as local mysql instance? following code worked in JDBC,I need such a configuration in hibernate.
if (SystemProperty.environment.value() ==
SystemProperty.Environment.Value.Production) {
// Load the class that provides the new "jdbc:google:mysql://" prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://your-project-id:your-instance-name/guestbook?user=root";
} else {
// Local MySQL instance to use during development.
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://127.0.0.1:3306/guestbook?user=root";
// Alternatively, connect to a Google Cloud SQL instance using:
// jdbc:mysql://ip-address-of-google-cloud-sql-instance:3306/guestbook?user=root
}
回答1:
I suggest you check out the official docs on how to use JPA-based ORM libs with Cloud SQL.
来源:https://stackoverflow.com/questions/25158746/hibernate-configuration-for-app-engine