[appengine-java] Re: Writing to the high replication datastore

2011-12-01 Thread Lars Werkman
Thank you very much for your help!

I will have a look through some files .
But i am still not shure why the reference is going wrong
I use eclipse but the imports looks like going fine




-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/nK0f1PUlVUQJ.
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] Writing to the high replication datastore

2011-11-30 Thread Lars Werkman
Hi,

I have never worked with datastores before but i want to write
to the datastore but when i try to use the samples from docs
i get these errors

*Caused by: java.lang.Error: Unresolved compilation problems: The import 
 com.google.android cannot be resolved The import 
 com.google.appengine.api.datastore cannot be resolved The import 
 com.google.appengine.api.datastore cannot be resolved The import 
 com.google.appengine.api.datastore cannot be resolved The import 
 com.google.appengine.api.datastore cannot be resolved PMF cannot be 
 resolved DatastoreService cannot be resolved to a type 
 DatastoreServiceFactory cannot be resolved Entity cannot be resolved to a 
 type Entity cannot be resolved to a type*


if have put this code in the code for my widget

DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();


 Entity employee = new Entity(Employee);

 employee.setProperty(firstName, Antonio);

 employee.setProperty(lastName, Salieri);

 employee.setProperty(attendedHrTraining, true);


 datastore.put(employee);


What is the problem please help me

(sorry for the bad english) 

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/xdTilZyb3GkJ.
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: Checking if I understand transactions correctly

2011-05-31 Thread Lars Borup Jensen
Huh?

As you are only able to do work in a single transactional unit-of-work
on a single entity-group, rollback must be considered usefull.
In the above mentioned snippet, an Account entity is looked-up,
updated and a child entity TransactionRecord is added, all in a single
entity-group, namely the Account's. So a rollback will undo all
operations.
If you had added TransactionRecord to, lets say a TransactionRecords
entity-group, you would have gotten an error if you were operating in
a transactional scope, or no-transaction support at all, hence a
rollback would not have been possible.

Cheers, Lars Borup Jensen

On 1 Jun., 06:21, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 entity group is not useful at rollback but rather limits you to which
 updates you can do: all the entities you touch in a single transaction
 must be in the same entity group.

 So, designing your groups properly is a key design issue in GAE to
 avoid unnecessary complexity when you later need to update at once
 entities that you created before in various groups.

 regards

 didier

 On May 30, 7:57 am, Jacob jacob.rho...@gmail.com wrote:







  I am writing some code that needs to do a rollback on a secondary
  object/table should the transaction fail, I believe this can be done
  via entity groups, however I am not sure if this is how it would be
  implemented. I have written some sample code to check if what I would
  be doing is correct?

  Would the following code ensure the Account object is never updated
  if the insert of the TransactionRecord object fails.

          public void addTransaction(String account, Double value, String
  description, Date date) throws EntityNotFoundException {
                  DatastoreService datastore =
  DatastoreServiceFactory.getDatastoreService();

                  int retries = 3;
                  while (true) {
                          Transaction txn = datastore.beginTransaction();
                          try {

                                  // Update the bank balance
                                  Key key = KeyFactory.createKey(Account, 
  account);
                                  Entity e = datastore.get(key);
                                  Double balance = (Double) 
  e.getProperty(balance);
                                  balance += value;
                                  e.setProperty(balance, value);
                                  datastore.put(e);

                                  // Record transaction details
                                  Entity d = new Entity(TransactionRecord, 
  key);
                                  d.setProperty(account_key, key);
                                  d.setProperty(date, date);
                                  d.setProperty(value, value);
                                  d.setProperty(description, description);

                                  txn.commit();
                                  break;
                          } catch (ConcurrentModificationException e) {
                                  if (retries == 0)
                                          throw e;
                                  --retries;
                          } finally {
                                  if (txn.isActive())
                                          txn.rollback();
                          }
                  }

          }

  Thanks for any feedback!

-- 
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: Login redirect failing all of a sudden /_ah/conflogin

2011-03-07 Thread Lars Rönnbäck
Where and when was this change announced? It is causing a major
inconvenience right now before we are able to push a new release with
the suggested workaround. I don't want to end up in this situation
ever again.

We have built a client-side web application using HTML5 that stores
information in the cloud using Google App Engine, and we need to
redirect back to the site hosting the client app after the login. The
funny thing is that after I see the error and go back to the site
hosting the client app I am still not logged in, so I suppose that
there is an extra step in the login procedure that does not got
executed right now?

Regards,
Lars


On Mar 4, 8:59 pm, Jon McAlister jon...@google.com wrote:
 The workaround is to have the app perform the redirect. That is,
 createLoginUrl only works when the continue url is a url for the app.
 If you need the user to be sent to another app/host after login, then
 your app needs to do that redirect.







 On Fri, Mar 4, 2011 at 11:47 AM, Glenn glenn.mur...@gmail.com wrote:
  What was the good workaround?  Our login is broken, too.

  We have two App Engine apps: one is the front end and one the back
  end,
  with a REST API.  When the user accesses the front end a call to the
  back end is made where

  redirect = userService.createLoginURL(gae front end);

  is called.  In this case both apps have appspot.com urls and
  it worked well.  We are dead in the water now.

  Please help!

  Thanks,
  Glenn

  On Mar 2, 12:31 pm, Jon McAlister jon...@google.com wrote:
  Looks like you pushed a good workaround already, but yes that was a
  result of a new login system yesterday, and looks like it is not
  handling this case like the prior system did.

  Specifically, calling createLoginUrl where the continue url is not the
  same as the url the app is hosted on. And, furthermore, the continue
  url is not an app engine url at all.

  For now, what you did was a good workaround. That is, use an app
  engine url as the continue url, and then have the app engine app
  redirect to the non-app-engine url.

  Need to think on this case some more.

  On Wed, Mar 2, 2011 at 7:53 AM, Joerg Weingarten jbwinvest...@gmail.com 
  wrote:
   Since this morning my call to userservice.createLoginUrl produces a
   url that doesn't work anymore. When selecting my Sign in link, which
   has a url like:

  https://www.google.com/accounts/ServiceLogin?service=ahpassive=true;...

   I get the error:

   The requested URL /_ah/conflogin was not found on this server.

   Somebody please help.

   Thx
   ---Joerg---

   --
   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 
   athttp://groups.google.com/group/google-appengine-java?hl=en.

  --
  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 
  athttp://groups.google.com/group/google-appengine-java?hl=en.

-- 
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: Lightweight Best performing MVC framework - Recommendation

2011-01-02 Thread Lars Borup Jensen
+1 on Stripes. Extremely easy to setup and use - very powerfull and
performs quite well on GAE as its basically just a somewhat simple
filter/servlet and JSP with a stripes taglib though still, as I said,
powerfull.
I had to make a few adjustments to get it to serve @UrlBinding(/)
for example and I ALWAYS want it to exec controller before being
forwarded to any JSP files.

Regards, Lars Borup

-- 
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-j...@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] Inverted Index

2010-08-26 Thread Lars Borup Jensen
Hi guys,

Since there is no full-text search available in GAE/j and I really
need this for a new app I am writing I have made a prototype
implementation of an inverted index using GAE store.

Term is stored as a key with actual term as name in key (only key is
needed)
Below each term I've added document references as another key like
this Term(term)/DocumentRef(10) where 10 is the internal document
number.
An example:

Term(stuff)
  DocRef(1)
  DocRef(2)

Term(more)
  DocRef(1)

When searching for e.g. more stuff (which is boolean and) I do this:

Query DocRef's from the Term with the least doc-refs (children, this
info is cached) and load keys into a sorted set.
Then query for doc-refs under the second term filtering from the min.
doc-id in the sorted set and the max doc-id (meaning we only get
possible matches in the docs we've know contains the first term.
Merge sets.

What do you think? Is this a fair way to implement this (working on
scoring using tf-idf) and do you think its possible to get it to
perform well?

/Lars Borup

-- 
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-j...@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] Failing to retrieve child-objects in a one-to-many JDO relation in datastore

2009-10-19 Thread Lars

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 ListChild childs;

public ParentDTO()
{

}

public void add(Child c)
{
if (childs == null)
childs = new ArrayListChild();
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);
ListParent parents = (ListParent) query.execute();
IteratorParent 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
IteratorChild 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
-~--~~~~--~~--~--~---