public class MyModule extends ServletModule {
protected void configureServlets() {
install(new JpaPersistModule("MyApp")); // like we saw earlier.
filter("/*").through(PersistFilter.class);
}
}
<?xml version="1.0" encoding="UTF-8"?><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" version="2.0">
<!--Define Persistence Unit for the application--> <persistence-unit name="MyApp" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>myapp.persistence.sql.entity.TestObject</class>
<properties> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://google/myapp?cloudSqlInstance=myapp-instance:us-east1:myapp&socketFactory=com.google.cloud.sql.mysql.SocketFactory" /> <property name="javax.persistence.jdbc.user" value="root" /> <property name="javax.persistence.jdbc.password" value="password" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.connection.useUnicode" value="true" /> <property name="hibernate.connection.characterEncoding" value="UTF-8" /> <property name="validationQuery" value="SELECT 1" /> <property name="testOnBorrow" value="true" /> </properties> </persistence-unit></persistence>
<property name="hibernate.connection.provider_class" value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" /><property name="hibernate.c3p0.max_size" value="100" /><property name="hibernate.c3p0.min_size" value="0" /><property name="hibernate.c3p0.acquire_increment" value="1" /><property name="hibernate.c3p0.idle_test_period" value="300" /><property name="hibernate.c3p0.max_statements" value="0" /><property name="hibernate.c3p0.timeout" value="100" /><property name="hibernate.c3p0.preferredTestQuery" value="SELECT 1" />java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details