jdo

How to auto-fetch JDO nested collection of entities?

安稳与你 提交于 2019-12-12 07:20:53
问题 Probably a very trivial problem. I have an object that looks like this: @PersistenceCapable public class Parent { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private String _id; @Persistent private List<Child> _children; //... } ... the nested entity looks like this (I am forced to declare primary key as Key otherwise it won't persist): @PersistenceCapable public class Child { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key _id;

Duplicate entry Exception using GoogleAuthorizationCodeFlow with JdoCredentialStore and DataNucleus

可紊 提交于 2019-12-12 05:32:11
问题 I have a problem with the GoogleAuthorizationCodeFlow ( Java ). I am trying to build a Google Calender connection for my web project using Google's "OAuth 2.0 for Web Server Applications". Therefore you are able to use Google's Java api libraries. I use Google's AuthorizationCallbackServlet to recieve an access and refresh token. GoogleAuthorizationCodeFlow persists the created Credential with GoogleAuthorizationCodeFlow and their JdoCredentialStore. As a JDO implementation I am using

GAE: Comparing String value returning false results when executing JDO query

丶灬走出姿态 提交于 2019-12-12 03:16:46
问题 For an iOS project I'm using GAE (Java stack) to store the user's device token and use it to send Push notifications. I have a Device entity which contains several fields, including "appVersion" field of type String. The database contains some Devices with version 1 and some with version 2. When I run a JDO query to find all devices with "appVersion" equals to 2 it returns the expected result, but when I do the same with version 1 the query return no result, although there are Entities which

appengine datastore query escaping single quote (')

夙愿已清 提交于 2019-12-12 03:12:41
问题 I have used javax.jdo.Query like here JDO for Google App Engine: escaping quotes. Yet, my query string with single quote (') keep getting exploded. Query query = pm.newQuery("select from " + Book.class.getName() + " where mArtist== '"+ artist + "' && mTitle=='" + title + "'"); Here is the exception javax.jdo.JDOUserException: Portion of expression could not be parsed: 't Give Up' org.datanucleus.store.query.QueryCompilerSyntaxException: Portion of expression could not be parsed: 't Give Up'

appengine datastore change entities property

白昼怎懂夜的黑 提交于 2019-12-12 02:32:04
问题 I would like to change the entity property from String to long. I have seen Nick answering similar problem in Change IntegerProperty to FloatProperty of existing AppEngine DataStore but I am writing in Java and need some code example since I don't know anything about the mapreduce. e.g. we want to change userId from String to Long of this class. I also would like to get advice on my thinking of storing date in long instead of String so that the time information can be consumed readily from

Datanucleus JDO Retrieve newly generated primary key

守給你的承諾、 提交于 2019-12-12 01:35:43
问题 I am using datanucleus and jdo in a GWT project. How can I retrieve the generated primary key after adding an element to the database with makePersistent() Edit We use annotations, here is the primary key: @PrimaryKey @Column(name = "id_bla", allowsNull = "false") @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, extensions = { @Extension(vendorName = "datanucleus", key = "strategy-when-notnull", value = "false") }) private Long idBla; I am not the one who did the mapping and I don't

ArrayList of super class type

别来无恙 提交于 2019-12-12 01:09:49
问题 I use mongodb-datanucleus in my project. I configure my jdoconfig.xml as follow : <persistence-manager-factory name="mongodb-factory"> <property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory" /> <property name="javax.jdo.option.ConnectionURL" value="mongodb:localhost/test" /> <property name="javax.jdo.option.Mapping" value="mongodb" /> <property name="javax.jdo.option.ConnectionUserName" value="username" /> <property name="javax

Flaky Loading of 1-N Relationships with DataNucleus 3.x

丶灬走出姿态 提交于 2019-12-11 18:44:19
问题 I am using DataNucleus 3.0.0-release JDO implementation to connect my Java app to MongoDB. The related JARs in my CLASSPATH are as follows: datanucleus-api-jdo-3.0.0-release.jar datanucleus-core-3.0.0-release.jar datanucleus-jdo-query-3.0.0-release.jar datanucleus-mongodb-3.0.0-release.jar mongo-java-driver-2.5.2.jar UPDATE : This problem also occurred with version 3.1 and is related to DataNucleus' Level2 cache. See my answer below for a workaround. The class that I am trying to load is as

No persistence providers available for “transactions-optional”

三世轮回 提交于 2019-12-11 18:42:35
问题 I'm having this error in my AppEngine project: javax.persistence.PersistenceException: No persistence providers available for "transactions-optional" after trying the following discovered implementations: org.datanucleus.api.jpa.PersistenceProviderImpl at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:180) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70) jdoconfig.xml <jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig" xmlns

Is there a way to have a non-persistent field in GAE/J using JDO?

好久不见. 提交于 2019-12-11 14:19:32
问题 I intend questions not to be a child since I had to manipulate it independently, and I don't want to persist the questions field, I would to fill it up by retrieving the questions manually. Here is the code. Questionnaire.java @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Questionnaire{ //supposedly non-persistent public List<Question> questions = new ArrayList<Question>(); @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) public Long