jdo

How to always use the same PersistenceManager within the same RPC request on Google App Engine

笑着哭i 提交于 2020-01-02 12:09:57
问题 Is there a way to ensure the same PersistenceManager instance is used throughout the different code parts executed in the context of the same RPC request? Having to manually handle out the persistence manager instance from function to function is quite a pain: for example: private void updateItem(ItemModel listItem) throws UserNotLoggedInException { PersistenceManager pm = PMF.get().getPersistenceManager(); if (isItemIsNew(pm, listItem)) { workOnItem(pm, listItem); } workSomeMoreOnItem(pm,

On Google App Engine (GAE), how do I search on the Key/ID field?

淺唱寂寞╮ 提交于 2020-01-02 11:04:23
问题 I've got this code (Java, GAE): // Much earlier: playerKey = KeyFactory.keyToString(somePlayer.key); // Then, later... PersistenceManager pm = assassin.PMF.get().getPersistenceManager(); Key targetKey = KeyFactory.stringToKey(playerKey); Query query = pm.newQuery(Player.class); query.setFilter("__key__ == keyParam"); query.declareParameters("com.google.appengine.api.datastore.Key keyParam"); List<Player> players = (List<Player>) query.execute(targetKey); // <-- line 200 which generates this

JDOQL DATANUCLEUS filtering using String matches

爷,独闯天下 提交于 2020-01-01 19:41:17
问题 Using JDO with Datanucleus, I'm trying to filter some data from my database (using jdoql). I would like to use the regular expression for some sophisticated searchs, I found that JDO provide the String method "matches" that accepts a regular expression, and according to the DATANUCLEUS documentation, this method can receive any type of ExpReg: matches(String pattern) : Returns whether string matches the passed expression. The pattern argument follows the rules of java.lang.String.matches

Unable to get ID of newly-created JDO persistent entity using GAE/J DataNucleus plug-in version 2.1.2

[亡魂溺海] 提交于 2020-01-01 12:07:05
问题 My problem I am porting my application from version 1.x to 2.0 of the DataNucleus plug-in for GAE/J using the new 1.7.5 GAE/J SDK. This changes my JDO version from 2.3 to 3.0.1. My persistent entity class has a primary key of type encoded string, along with read-only access to the object’s numeric ID. Each instance is the sole member of its entity group (children and parent are linked by numeric ID only). Previously, I have been able to create and persist a new MyEntity instance and then

Persist List of objects

做~自己de王妃 提交于 2019-12-31 05:16:06
问题 I got this "javax.jdo.JDOFatalUserException: Error in meta-data for don.Comment.id: Cannot have a java.lang.String primary key and be a child object (owning field is don.Post.comments). NestedThrowables:" when running my grails + app-engine webapp How can I fix this? class Comment.groovy import javax.jdo.annotations.*; @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") class Comment implements Serializable { @PrimaryKey @Persistent(valueStrategy =

Google App Engine, JDO, and equals/hashCode

拜拜、爱过 提交于 2019-12-30 03:09:29
问题 I've got an app in Google App Engine that was working fine. I realized that one on of my JDO-enhanced objects that I forgot to implement equals and hashCode (I need to use the object in a set). So I did. I didn't really do anything special in these implementations, in fact I just used Eclipse to generate them. Like so: @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String appleId; @Override public int hashCode() { final int prime =

one to many relationship in java google ap engine caused error ?

偶尔善良 提交于 2019-12-29 09:40:19
问题 i have implement a system to save information about user . So i have aggregation at my class so the user class has list from contact class ...etc in the first page "test it's just for register the user just by phone number " that must save the user in database but this cause error when i deploye my project in Google app engine < 500 server error > and the other page for update the exist user who previously has been registered, so at this will add to the list which the user object has . user

What is the difference between javax.persistence.metamodel.Map and java.util.Map?

梦想与她 提交于 2019-12-25 08:05:46
问题 I am trying to write a JDO annotated class in GAE and I want to persist a map. The map is supposed to be an entity field that is a collection of entities hashed by Date. (I am not even sure if this is the right approach). Eclipse's auto-complete provides me with javax.persistence.metamodel.Map and java.util.Map. What is the difference between these two? What is an example of the former? 回答1: One is a class from a standard Java library that is supported in GAE, and the other is part of the JPA

How to create a setter for a GeoPt field of a JDO entity in App Engine datastore such that it shows up in the endpoint client library?

≯℡__Kan透↙ 提交于 2019-12-25 06:53:04
问题 I have a GeoPt field for a JDO entity on App Engine and I created the following setter for it: public void setLocation(Float latitude,Float longitude){ location=new GeoPt(latitude, longitude); } However, when I generate the Cloud Endpoints client library through Google Plugin for Eclipse, this method does not show up in the list of methods available for this entity. How should I modify the setter such that the client library creates an endpoint for it? 来源: https://stackoverflow.com/questions

JDO Persist an existing entity creats new entry in DB

佐手、 提交于 2019-12-25 02:23:12
问题 This is my too first exemple using JDO I have the class Account : public class Compte { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.INCREMENT) private int idCompte; // other attributes private Regle regle; // .... } I have entities saved in the table regle, and when i want to create a new Compte i retreive one of those Regle and i add it to the new Compte and i make Compte persisted. I do that : Compte compte = new Compte(); Regle regle = retreiveRegleByName(name); compte