google app engine 支持java了,所以这几天一直在搞鼓这东西,
本人喜欢用spring框架,恰好它又支持,正合心意
但是弄了3天,spring的DispatcherServlet工作的有点问题,
暂时不弄了,转向去搞GAE的数据库,GAE的数据库只能用jdo
但是平时没用过jdo,用spring配置操作就更不用说了
今天在网上狂搜了一下,找到的配置都是用于关系型数据库 的,
GRE可不支持这个
实在没办法,就找LocalPersistenceManagerFactoryBean的源代码看了看
发现里面还有其他方法配置jdo属性的,里面如下一段注释以及4个方法:
/**
* Specify the name of the desired PersistenceManagerFactory.
* <p>This may either be a properties resource in the classpath if such a resource exists
* (JDO 2.0), or a PMF definition with that name from "META-INF/jdoconfig.xml" (JDO 2.1),
* or a JPA EntityManagerFactory cast to a PersistenceManagerFactory based on the
* persistence-unit name from "META-INF/persistence.xml" (JDO 2.1 / JPA 1.0).
* <p>Default is none: Either 'persistenceManagerFactoryName' or 'configLocation'
* or 'jdoProperties' needs to be specified.
* @see #setConfigLocation
* @see #setJdoProperties
*/
public void setPersistenceManagerFactoryName (String persistenceManagerFactoryName );
public void setConfigLocation (Resource configLocation );
public void setJdoProperties (Properties jdoProperties );
public void setJdoPropertyMap (Map <String , Object > jdoProperties );
因为GRE用的配置文件是jdoconfig.xml,所以只要配置 persistenceManagerFactoryName 属性就搞定了
哇卡卡卡
补充:
搞鼓了一晚上,结果竟然是LocalPersistenceManagerFactoryBea无法识别出jdoconfig的属性文件
它是找得到,但是里面的的配置信息认不出来,结果最后自己另外写了一个jdoProperties文件来保存配置信息了
我是直接配置在applicationContext.xml 里面了,免得麻烦
哎.......