localhostで実行したGoogle SQL Cloudを使用してGAEでこのエラーを解決する方法を教えてもらえますか?問題はありませんが、GAEにデプロイするとこのエラーが表示されます
javax.servlet.ServletContext ログ: 着信 RPC 呼び出しのディスパッチ中に例外が発生しましたこの SerializationPolicy またはその Class オブジェクトを読み込めませんでした。セキュリティ上の理由から、このタイプはシリアル化されません。: インスタンス = org.hibernate.exception.SQLGrammarException: com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:619 でクエリを実行できませんでした) ) com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126) で com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.
Hibernate Util のこのコード
package com.ies.ieschool.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSession() {
return sessionFactory;
}
}
これはDTO用です
package com.ies.ieschool.shared;
// Generated 31 �.�. 2555, 1:54:03 by Hibernate Tools 3.4.0.CR1
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import net.sf.gilead.pojo.gwt.LightEntity;
/**
* Province generated by hbm2java
*/
@Entity
@Table(name = "province", catalog = "ieschool")
public class Province extends LightEntity implements Serializable {
private static final long serialVersionUID = 1L;
private short provinceId;
private Geography geography;
private String provinceCode;
private String provinceName;
private Set<Father> fathers;
private Set<Mother> mothers;
private Set<Student> studentsForAddressProvince;
private Set<Student> studentsForAddressCensusProvince;
private Set<Student> studentsForGraduatedSchoolProvince;
private Set<Student> studentsForBirthAddressProvince;
private Set<City> cities;
private Set<ExperienceWork> experienceWorks;
private Set<District> districts;
private Set<Guardian> guardians;
private Set<Postcode> postcodes;
private Set<Personal> personalsForAddressProvince;
private Set<SeminarProfile> seminarProfiles;
private Set<Personal> personalsForLicenseIssueProvince;
public Province() {
}
@Id
@Column(name = "province_id", unique = true, nullable = false)
public short getProvinceId() {
return this.provinceId;
}
public void setProvinceId(short provinceId) {
this.provinceId = provinceId;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "geography_id", nullable = false)
public Geography getGeography() {
return this.geography;
}
public void setGeography(Geography geography) {
this.geography = geography;
}
@Column(name = "province_code", nullable = false, length = 2)
public String getProvinceCode() {
return this.provinceCode;
}
public void setProvinceCode(String provinceCode) {
this.provinceCode = provinceCode;
}
@Column(name = "province_name", nullable = false, length = 150)
public String getProvinceName() {
return this.provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Father> getFathers() {
return this.fathers;
}
public void setFathers(Set<Father> fathers) {
this.fathers = fathers;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Mother> getMothers() {
return this.mothers;
}
public void setMothers(Set<Mother> mothers) {
this.mothers = mothers;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressProvince")
public Set<Student> getStudentsForAddressProvince() {
return this.studentsForAddressProvince;
}
public void setStudentsForAddressProvince(Set<Student> studentsForAddressProvince) {
this.studentsForAddressProvince = studentsForAddressProvince;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressCensusProvince")
public Set<Student> getStudentsForAddressCensusProvince() {
return this.studentsForAddressCensusProvince;
}
public void setStudentsForAddressCensusProvince(
Set<Student> studentsForAddressCensusProvince) {
this.studentsForAddressCensusProvince = studentsForAddressCensusProvince;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByGraduatedSchoolProvince")
public Set<Student> getStudentsForGraduatedSchoolProvince() {
return this.studentsForGraduatedSchoolProvince;
}
public void setStudentsForGraduatedSchoolProvince(
Set<Student> studentsForGraduatedSchoolProvince) {
this.studentsForGraduatedSchoolProvince = studentsForGraduatedSchoolProvince;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByBirthAddressProvince")
public Set<Student> getStudentsForBirthAddressProvince() {
return this.studentsForBirthAddressProvince;
}
public void setStudentsForBirthAddressProvince(
Set<Student> studentsForBirthAddressProvince) {
this.studentsForBirthAddressProvince = studentsForBirthAddressProvince;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<City> getCities() {
return this.cities;
}
public void setCities(Set<City> cities) {
this.cities = cities;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<ExperienceWork> getExperienceWorks() {
return this.experienceWorks;
}
public void setExperienceWorks(Set<ExperienceWork> experienceWorks) {
this.experienceWorks = experienceWorks;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<District> getDistricts() {
return this.districts;
}
public void setDistricts(Set<District> districts) {
this.districts = districts;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Guardian> getGuardians() {
return this.guardians;
}
public void setGuardians(Set<Guardian> guardians) {
this.guardians = guardians;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<Postcode> getPostcodes() {
return this.postcodes;
}
public void setPostcodes(Set<Postcode> postcodes) {
this.postcodes = postcodes;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByAddressProvince")
public Set<Personal> getPersonalsForAddressProvince() {
return this.personalsForAddressProvince;
}
public void setPersonalsForAddressProvince(Set<Personal> personalsForAddressProvince) {
this.personalsForAddressProvince = personalsForAddressProvince;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "province")
public Set<SeminarProfile> getSeminarProfiles() {
return this.seminarProfiles;
}
public void setSeminarProfiles(Set<SeminarProfile> seminarProfiles) {
this.seminarProfiles = seminarProfiles;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "provinceByLicenseIssueProvince")
public Set<Personal> getPersonalsForLicenseIssueProvince() {
return this.personalsForLicenseIssueProvince;
}
public void setPersonalsForLicenseIssueProvince(
Set<Personal> personalsForLicenseIssueProvince) {
this.personalsForLicenseIssueProvince = personalsForLicenseIssueProvince;
}
}
これはDAO用です
package com.ies.ieschool.server;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import com.ies.ieschool.client.service.ProvinceService;
import com.ies.ieschool.shared.Province;
import net.sf.gilead.core.PersistentBeanManager;
import net.sf.gilead.core.hibernate.HibernateUtil;
import net.sf.gilead.core.serialization.GwtProxySerialization;
import net.sf.gilead.core.store.stateless.StatelessProxyStore;
import net.sf.gilead.gwt.PersistentRemoteService;
@SuppressWarnings("serial")
public class ProvinceImpl extends PersistentRemoteService implements ProvinceService{
public ProvinceImpl() {
HibernateUtil hibernateUtil = new HibernateUtil();
hibernateUtil.setSessionFactory(com.ies.ieschool.util.HibernateUtil.getSession());
PersistentBeanManager persistentBeanManager = new PersistentBeanManager();
persistentBeanManager.setPersistenceUtil(hibernateUtil);
StatelessProxyStore sps = new StatelessProxyStore();
sps.setProxySerializer(new GwtProxySerialization());
persistentBeanManager.setProxyStore(sps);
setBeanManager(persistentBeanManager);
}
@Override
public Province findProvinceByPK(int provinceId) throws Exception {
Province province;
Session session = com.ies.ieschool.util.HibernateUtil.getSession().getCurrentSession();
session.beginTransaction();
province = (Province) session.createQuery("SELECT new Province( " +
"pvn.provinceId, " +
"pvn.provinceName " +
") " +
"FROM Province pvn " +
"WHERE pvn.provinceId = :id " +
"ORDER BY pvn.provinceName").setInteger("id", provinceId).uniqueResult();
session.getTransaction().commit();
return province;
}
@Override
public List<Province> findAllProvince() throws Exception {
List<Province> list = null;
Session session = com.ies.ieschool.util.HibernateUtil.getSession().getCurrentSession();
session.beginTransaction();
list = new ArrayList<Province> (session.createQuery("SELECT new Province( " +
"pvn.provinceId, " +
"pvn.provinceName " +
") " +
"FROM Province pvn " +
"ORDER BY pvn.provinceName").list());
session.getTransaction().commit();
return list;
}
}
これは休止状態のマッピング用 (hibernate.cfg.xml)
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.google.appengine.api.rdbms.AppEngineDriver</property>
<property name="hibernate.connection.useUnicode">true</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.connection.url">jdbc:google:rdbms://ies-thamvitya-db:ieschool/ieschool_rif</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.connection.username"></property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.pool_size">1</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="current_session_context_class">thread</property>
<property name="javax.persistence.validation.mode">none</property>
<mapping class="com.ies.ieschool.shared.Province" />
</session-factory>
</hibernate-configuration>