Configure spring to manage JDO in Google App Engine

Source: Internet
Author: User

The reason is that I don't know how to design the update method of JDO. Then I would like to refer to some other specific operations when I directly import objects during General update operations, then download a complete set of spring source code for reference. I found that the spring ORM package not only encapsulates mainstream cash storage methods, but also supports JDO and JPA, therefore, I don't need to write the JDO encapsulation of the base class myself, so use it directly. Since there are relatively few examples of combining spring and JDO on the internet, I am also very depressed, how can I configure it badly?

<Bean id = "persistencemanagerfactory" class = "org. springframework. Orm. JDO. localpersistencemanagerfactorybean">

Some configuration information under this bean. In the absence of spring, persistencemanagerfactory is directly returned through a factory class,

Private Static final persistencemanagerfactory pmfinstance = jdohelper. getpersistencemanagerfactory ("transactions-optional ");

Therefore, when I see similar configurations on the internet, I am particularly sensitive. <property name = "persistencemanagerfactoryname" value = "transactions-optional"/>, of course, I will also check whether this parameter exists in this class. The younger brother hasn't fully understood the source code of spring. After a little reading, I found this class in this class, try it first. Unfortunately, when you actually use it, the result will be thrown incorrectly. In a difficult search, I found a copy of this address so that I can start the service without throwing any errors.Code(Http://wjing63.javaeye.com/blog/464310), but unexpectedly, when performing the makepersistent operation, the hateful error comes again, exception is as follows:
Java. Lang. nosuchmethoderror: javax. JDO. persistencemanager. makepersistent (ljava/lang/object;) V
At org. springframework. Orm. JDO. jdotemplate $9. doinjdo (jdotemplate. Java: 374)
At org.springframework.orm.jdo.jdotemplate.exe cute (jdotemplate. Java: 228)
At org. springframework. Orm. JDO. jdotemplate. makepersistent (jdotemplate. Java: 372)
Since at this moment I have been tired of bombing, so continue Google, found a pretty convincing post in a forum (http://www.jpox.org/servlet/forum/viewthread? Thread = 3500) index by graph and re-update spring. jar in the application. The result is fine.

 

The complete configuration is summarized as follows:
<Bean id = "persistencemanagerfactory"
Class = "org. springframework. Orm. JDO. localpersistencemanagerfactorybean">
<Property name = "jdoproperties">
<Props>
<Prop key = "javax. JDO. persistencemanagerfactoryclass">
Org. datanucleus. Store. appengine. JDO. datastorejdopersistencemanagerfactory
</Prop>
<Prop key = "javax. JDO. Option. connectionurl">
Appengine
</Prop>
<Prop key = "javax. JDO. Option. nontransactionalread">
True
</Prop>
<Prop key = "javax. JDO. Option. nontransactionalwrite">
True
</Prop>
<Prop key = "javax. JDO. Option. retainvalues">
True
</Prop>
<Prop key = "datanucleus. appengine. autocreatedatastoretxns">
True
</Prop>
</Props>
</Property>
<! -- Property name = "persistencemanagerfactoryname" value = "transactions-optional"/-->

</Bean>

<Bean id = "jdotransactionmanager" class = "org. springframework. Orm. JDO. jdotransactionmanager">
<Property name = "persistencemanagerfactory" ref = "persistencemanagerfactory"/>
</Bean>

<Bean id = "transactioninterceptor" class = "org. springframework. transaction. Interceptor. transactionproxyfactorybean">
<Property name = "transactionmanager" ref = "jdotransactionmanager"/>
<Property name = "target" ref = "employeeservice"/>
<Property name = "transactionattributes">
<Props>
<Prop key = "Save *"> propagation_required </prop>
<Prop key = "Update *"> propagation_required </prop>
<Prop key = "del *"> propagation_required </prop>
<Prop key = "*"> propagation_required, readonly </prop>
</Props>
</Property>
</Bean>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.