[appengine-java] Is the any limitation on entity group size?

2010-04-12 Thread ailinykh
Hello, everybody!
I have objects with owned one to many relationship. Child table is
supposed to grow, each parent eventually will have thousands or even
more child objects.
May it cause any performance issues? Is there any best practice to
handle this situation?


Thank you,
  Andrey

-- 
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] Re: Is the any limitation on entity group size?

2010-04-13 Thread ailinykh
For example, I want to know a number of children. I guess if I just
call list.size()
it could be expensive. What are other ways?

Thank you,
  Andrey

On Apr 12, 4:18 pm, "Ikai L (Google)"  wrote:
> No, it should be fine UNLESS you want to load all these child objects in a
> single request. As a rule of thumb, load as little data as possible. You may
> need to denormalize (the datastore isn't relational anyway) for additional
> read performance.
>
> For a better answer, you may want to describe what it is you are trying to
> do.
>
>
>
>
>
> On Mon, Apr 12, 2010 at 6:57 AM, ailinykh  wrote:
> > Hello, everybody!
> > I have objects with owned one to many relationship. Child table is
> > supposed to grow, each parent eventually will have thousands or even
> > more child objects.
> > May it cause any performance issues? Is there any best practice to
> > handle this situation?
>
> > Thank you,
> >  Andrey
>
> > --
> > 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 > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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] Re: Is the any limitation on entity group size?

2010-04-15 Thread ailinykh
One more question. How to make massive update?
 If it takes more then 30 sec engine probably will cancel it.
What are possible ways to do it?

Thank you,
  Andrey

On Apr 12, 4:18 pm, "Ikai L (Google)"  wrote:
> No, it should be fine UNLESS you want to load all these child objects in a
> single request. As a rule of thumb, load as little data as possible. You may
> need to denormalize (the datastore isn't relational anyway) for additional
> read performance.
>
> For a better answer, you may want to describe what it is you are trying to
> do.
>
>
>
>
>
> On Mon, Apr 12, 2010 at 6:57 AM, ailinykh  wrote:
> > Hello, everybody!
> > I have objects with owned one to many relationship. Child table is
> > supposed to grow, each parent eventually will have thousands or even
> > more child objects.
> > May it cause any performance issues? Is there any best practice to
> > handle this situation?
>
> > Thank you,
> >  Andrey
>
> > --
> > 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 > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App 
> Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
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] What is the best way to store child object?

2010-04-20 Thread ailinykh
Hello, everybody!
I have simple one to many owned relationship:
...
class MyList{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent(mappedBy="myList")
@Element(dependent = "true")
List items;
  ...
}


class Item{
   @PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
   @Persistent
   MyList myList;
  ...
}

When I add new Item I do

tx.begin();

Key key = getParentKey();
MyList myList = pm.getObjectById(MyList.class, key);

Item item = new Item();
item.setMyList(myList);
myList.items.add(item);

tx.commit();

It works. But there are couple things which bother me. First at all,
there is some extra job here. I actually don't need instance of parent
class (MyList).
I have the parent key. Theoretically speaking, it is the only thing
needed to maintain parent child relationship. MyList class may have
more fields I don't need at all. So, I'd like to avoid reading them to
memory.
Second concern is about line

myList.items.add(item);

what if MyList already has million of items? How efficient is add
operation in this case?

Any thoughts? Is it possible to store child object using parent key
only?

Thank you,
  Andrey

-- 
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] Re: What is the best way to store child object?

2010-04-22 Thread ailinykh
Thank you Ikai!

> > I have the parent key. Theoretically speaking, it is the only thing
> > needed to maintain parent child relationship. MyList class may have
> > more fields I don't need at all. So, I'd like to avoid reading them to
> > memory.
>
> You can do this with KeyFactory.Builder. Build a Key using the parent and
> child Keys, then query using this Key. You can also use an ancestor query to
> find multiple child items.
>

Yes, I use key builder when I query children. I'm asking about adding
a new child.
The problem is - child key is auto generated by data store, I don't
know key until I save child object.
To save child object I need to add it to the parent, which means I
have to load the parent object and call
something like

parent.getList().add(child);

Does it mean with auto generated id I always have to load parent
object first?

Thank you,
  Andrey

-- 
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] Re: How to deal with large collections of objects?

2010-04-27 Thread ailinykh
define Cow as

class Cow {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;

@Persistent
@Extension(vendorName="datanucleus", key="gae.parent-pk",
value="true")
private Key farmKey;

}
If you set farmKey to farm id then both farm and cow will be in the
same entity group.

this code should work:

tx.begin()

Farm f = getFarm();
Cow c = new Cow();
c.setFarmKey(f.getId());
f.incCowCounter();
pm.makePersistent(c);  //if you need to know new cow id.

tx.commit();


Andrey



-- 
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] Re: Querying child objects based on parent key

2010-04-30 Thread ailinykh
JDO is a thin layer which gives you some kind of automation and
restriction.
But it exists only an run time. I mean you have to instantiate objects
first. In other words
Company c = getCompany();
for(Person p:c.getPersons()){
   if(p.isDeleted())
  continue;
  //do what ever you want to do
}



On Apr 29, 1:15 pm, korey_sed  wrote:
> I struggled with this for a while and could not find a clear example,
> so I hope it helps someone out there.
>
> I have a company object that has employees and employees could be
> deleted (boolean property).  So I wanted to search for all employees
> for company X where the company is not deleted.  It should be noted
> that I have a bidrectional owned relationship setup between Company
> and Person.
>
> here is how I did it in JDO:
>
> 
> Key companyKey = KeyFactory.stringToKey(companyKeyString);
> String queryStr = "select from " + Person.class.getName() +
>                         " where company == companyParam && deleted == false";
> Query q = pm.newQuery(queryStr);
> q.declareVariables(Company.class.getName() + " companyParam");
> persons = (List)q.execute(companyKey);
> 
>
> --
> 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 
> 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-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] cookie expiration

2010-05-21 Thread ailinykh
Hello, everybody!
Application Setting page allows to set cookie expiration period up to
2 weeks.
I'd like to have longer expiration period. Is there a way to do it?

Thank you,
  Andrey

-- 
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] Re: cookie expiration

2010-05-21 Thread ailinykh
And one more thing. I don't see  _ah_SESSION kind any more. What
happened?
Does it mean I can't force people to re-login?

Andrey

On May 21, 9:33 am, ailinykh  wrote:
> Hello, everybody!
> Application Setting page allows to set cookie expiration period up to
> 2 weeks.
> I'd like to have longer expiration period. Is there a way to do it?
>
> Thank you,
>   Andrey
>
> --
> 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 
> 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-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] how to add entity using map-reduce?

2010-07-18 Thread ailinykh
Hello, everybody!
I have simple one to many relationship Parent-> Child.
I want each parent entity to have one predefined Child entity. To do
it I iterate through all Parent entities (using map-reduce framework)
and add
one Child entity. There problem is- to maintain one to many
relationship I have to set up child_INTEGER_IDX field of Child entity.
I guess it should be number of children which already belong to this
Parent entity. The question is how can I get that number? In map-
reduce framework I know about Parent entity only. Any ideas how to
solve this problem?

Thank you,
  Andrey

-- 
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.