[appengine-java] Re: java.lang.NoClassDefFoundError
you can stub out this class into a separated module, say common module, which will be inherited by other modules in need. On Sun, Oct 18, 2009 at 11:00 AM, Sean Mitchell wrote: > > > A bit more searching turned up a workaround on this thread: > > http://groups.google.com/group/google-appengine-java/browse_thread/thread/dd84e44f604498c4 > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Re: Failing to retrieve child-objects in a one-to-many JDO relation in datastore
Hi Lars, Try to annotate your relationship as follows: @Persistent(mappedBy="parent", default-fetch-group="true") public List childs; On Tue, Oct 20, 2009 at 12:19 AM, Lars wrote: > > Hi, > I am failing to retrieve child-objects in a one-to-many JDO relation > in the datastore. The case is as follows; > > I have two classes (Parent & Child, code-snippet below) with a defined > one-to-many relation. > It is no problem storing the structure with the 'store'-operation > defined below. This is easily verified by web-browsing the datastore. > > However, when retrievning the parent-object from the datastore > ('fetchParents'), the ''childs' attribute is always null. What must be > done to (auto-)populate this attribute from the datastore? > Also, the 'parent'-attribute of the Child-objects will also be null if > they are fetched in a similar way. > > All clues appreciated... > > Lars > > - - - - - - - Code samples below - - - - - - > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public class ParentDTO { >@PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >@Extension(vendorName="datanucleus", key="gae.encoded-pk", > value="true") >private String encodedKey; > >@Persistent >public String name; > >@Persistent(mappedBy="parent") >public List childs; > >public ParentDTO() >{ > >} > >public void add(Child c) >{ >if (childs == null) >childs = new ArrayList(); >kids.add(c); >} > } > > - - - - > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > public class Child { >@PrimaryKey >@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >@Extension(vendorName="datanucleus", key="gae.encoded-pk", > value="true") >public String encodedKey; >@Persistent >public String name; > >@Persistent >public Parent parent; > >public Child() >{ >} > >public String getEncodedKey() { >return encodedKey; >} > } > > - - - - - > > Storing to datastore (works perfectly) > >public void store() >{ >Parent p = new Parent(); >p.navn = "nils"; > >Child c = new Child(); >c.name = "jim"; >p.add(c); > >c = new ChildDTO(); >c.name = "anne"; >p.add(c); > >PersistenceManager pm = > PMF.get().getPersistenceManager(); >try { >pm.makePersistent(p); >} catch (Exception ee) { >res = ee.getMessage(); >} finally { >pm.close(); >} >} > > - - - - - - Fetching data (not working) > >public String fetchParents() >{ >String res = ""; >PersistenceManager pm = > PMF.get().getPersistenceManager(); > >javax.jdo.Query query = pm.newQuery(Parent.class); >List parents = (List) query.execute(); >Iterator iterF = parents.iterator(); >while (iterF.hasNext()) { >Parent f = iterF.next(); >res = res + ":" + f.name; >if (f.childs != null) { // this is the > problem - 'this.childs' is > always null >Iterator iterI = > f.childs.iterator(); >while (iterI.hasNext()) { >Child idto = iterI.next(); >res = res + ">" + idto.name > ; >} >} >} >pm.close(); >} > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Re: Can anyone provide me an example on add/remove tag to an Entity?
Hi Rusty, Thanks for your reply. I know that is a tag, but what I am looking for is how to implement using GAE. Hi Jason, I can not make my question more specific because I totally have no idea on it. :) Can I say we just simply put a Set to an Entity? Then how can I make use of it when making a global search? Shall we iterate through every Set? If that's the case, then what's the difference between Set and Set ? Regards, Max On Wed, Oct 21, 2009 at 1:23 AM, Jason (Google) wrote: > Hi Max. This is currently the only reference available: > > http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Category.html > > Do you have any specific questions around it? > > - Jason > > > On Sat, Oct 17, 2009 at 10:02 AM, Max wrote: > >> >> I am not able to find a good reference on: >> com.google.appengine.api.datastore.Category >> >> Thanks >> Max >> >> > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Re: why dont my two longs equal each other?
persistence layer will try to set a "null" if one field has not been initialized, which leads to an exception. So you shall not try to persist a primitive type use Comparable.compare(Comparable o) instead, as nclemeur suggested. On Wed, Oct 21, 2009 at 6:20 PM, John V Denley wrote: > > AHHH, that actually explains a lot of other problems I have been > seeing with "Long" that i wasnt expecting > > so why would anyone use Long rather than long? Im guessing that long > is actually a basic datatype I suppose I can go look that up > myself though! > > Thanks for your help and input... I wish id figured that out at about > midnight last night, I could have gone to bed 4 hours earlier!!! LOL > > On Oct 21, 3:44 am, nclemeur wrote: > > Just use > > StoredID.equals(ID) > > > > These are objects in Java, so you need to use equals (or > > StoreID.longValue==ID.longValue) > > > > Cheers > > > > Nicolas > > > > On Oct 21, 12:39 pm, John VDenley wrote: > > > > > OK so Im sending in an ID number (Long) and Im doing a query on the > > > datastore, getting all the "contacts" in the database, using the > > > "getID" function to get the "StoredID" and comparing the ID's. > > > > > However for some reason the boolean "test" below never becomes true, > > > despite after stepping through the program there are times when > > > StoredID=16 and ID=16, but yet (StoredID==ID) does not evaluate to > > > "true" > > > > > anyone got any ideas? > > > > > public String updateContact(Long AdminID, Long ID, String > > > Name,String Phone, String KnownAs, String Notes) throws > > > NotLoggedInException { > > > > > Contact ContactToUpdate=null; > > > Long StoredID; > > > > > PersistenceManager pm = PMF.get().getPersistenceManager(); > > > try { > > > Query q = pm.newQuery(Contact.class, "AdminID == AID"); > > > q.declareParameters("Long AID"); > > > List Contacts = (List) > q.execute(AdminID); > > > for (Contact contact : Contacts) > > > { > > > > > StoredID=contact.getID(); > > > boolean test=(StoredID==ID); > > > if (test) > > > { > > > ContactToUpdate=contact; > > > } > > > else > > > { > > > ContactToUpdate=null; > > > } > > > } > > > } > > > finally > > > { > > > pm.close(); > > > } > > > } > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---
[appengine-java] Re: LIKE query workaround for the Low Level API
So far as I know, Bigtable only supports: myString LIKE "foo,%" On Fri, Oct 23, 2009 at 6:24 AM, Nicholas Albion wrote: > > I don't suppose it's possible to do: > >myString LIKE "%,foo,%" > > I'm surprised that the datastore used by a search engine doesn't have > better support for string searching/comparison... > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~--~~~~--~~--~--~---