[appengine-java] Re: Point to application database with JUnit Test

2009-12-03 Thread leszek
Judging from:

http://code.google.com/intl/pl/appengine/docs/java/howto/unittesting.html

---
if every test starts with a clean datastore
---

it clears local datastore every time - so it works as expected.

But may be after removing line:


   datastoreService.clearProfiles();


it will take existing datastore without cleaning.

But I'm guessing only, you have to play with that on your own.

--

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: Persisting class hierarchies

2009-12-03 Thread leszek
Inheritance and class hierarchy is very important in OOP but it has a
different meaning when it comes to persistence. You cannot take
advantage of OOP concepts like: encapsulation, polymorphic etc. So, as
Ikai pointed above, you can run into over-engineering trap going that
way.
In my opinion the best way is simply to design one big class:

public class AnimalOfAllAnimalls {
}

get all possible attributes here and add one single attribute like:

enum AnimalType {
  elephant, lion, mouse, whale ...
}

and field in you persistence class:
  @Persistent
  private AnimalType species;
...

and that's final.

Of course, some of attributes will be dead for some type of animal
but, nowadays, disk space is very cheap and engineer time very
expensive.

--

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: Point to application database with JUnit Test

2009-12-02 Thread leszek
This type of tests works for me without any problem. Could you provide
more details and what you mean exactly by system was unable to read
it ?

--

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: jdo on app engine

2009-12-02 Thread leszek
If you use pure long primary key than it can impact transactional
mechanism which is related to so called entity groups identified by
primary key values.

So before designing your entity classes read through:

http://code.google.com/intl/pl/appengine/docs/java/datastore/transactions.html

--

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: Any Sample Authentication Examples using GWT-App Engine

2009-11-25 Thread leszek
http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ

--

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 there a recommended way to differentiate between production and dev GAE environments?

2009-11-23 Thread leszek
Follow that thread:

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/8145f547cbaff99e/453847dda0217e71?q=#453847dda0217e71

--

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




[appengine-java] Re: Querying sub objects with JDOQL in GAE/J

2009-11-17 Thread leszek
It is not supported in Google App Engine JPA/JDO

http://code.google.com/intl/pl/appengine/docs/java/datastore/usingjdo.html#Unsupported_Features_of_JDO


Join queries. You cannot use a field of a child entity in a filter
when performing a query on the parent kind. Note that you can test the
parent's relationship field directly in query using a key.
---

The only way is to denormalization. Simple duplicate fields in
Employ and ContactInfo you want to query on.

--

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




[appengine-java] Re: Which datastore exceptions are appropriate for Re-try

2009-11-09 Thread leszek

http://code.google.com/intl/pl/appengine/docs/java/datastore/transactions.html


for (int i = 0; i  NUM_RETRIES; i++) {
pm.currentTransaction().begin();

ClubMembers members = pm.getObjectById(ClubMembers.class,
k12345);
members.incrementCounterBy(1);

try {
pm.currentTransaction().commit();
break;

} catch (JDOCanRetryException ex) {
if (i == (NUM_RETRIES - 1)) {
throw ex;
}
}
}

--~--~-~--~~~---~--~~
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: How to add new module?

2009-11-09 Thread leszek

It looks like GWT (not Google App Engine)  problem:

http://code.google.com/intl/pl/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModules
--~--~-~--~~~---~--~~
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: Querying for entities by filtering by key

2009-11-06 Thread leszek


 @Persistent(mappedBy = A)

Judging from:
http://www.jpox.org/docs/1_2/jdo/annotations.html

--
mappedByString  Field in other class when the relation is
bidirectional to signify the owner of the relation
--

'mappedBy' does not make any sense outside relationships. Probably
this field is not persisted at all, so this is the reason you retrieve
null value. Remove invalid annotation and should work as expected.

Elaborating more what is mentioned above simply run query (using JDO
convention):

A aa;
.

Query qq = pm.newQuery(B.class);
qq.setFilter(A == key);
qq.declareParameters(Key key);
qq.declareImports(import
com.google.appengine.api.datastore.Key);
ListB bli = (ListB) qq.execute(aa.getKey());

and should run like a demon.
--~--~-~--~~~---~--~~
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: GWT Vs JQuery

2009-11-06 Thread leszek

In Polish language it is called a discussion o wyższości Swiąt
Wielkiej Nocy nad Swiętami Bożego Narodzenia.- in English it is a
discussion on superiority Christmas over Easter or vice versa or
simply discussion on nothing.
So it is like discussion on what is better: GWT, JQuery, Dojo, Ext-
Gwt, Gwt-Ext etc. etc.
Im my opinion the better choice is GWT because it is already
integrated with Google App Engine eclipse and, on the whole, it is
very nice and interesting framework.
--~--~-~--~~~---~--~~
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: thanking uuuuuuuuu

2009-11-04 Thread leszek

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/b2d502bc03c83155#
--~--~-~--~~~---~--~~
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: What defines a single transaction in JDO?

2009-11-04 Thread leszek

Sequence:
tx.begin();
,,, persist Entity group A
tx.commit();
tx.begin();
.. persist Entity group B
tx.commit();

works without any problem as designed.

You have to provide more details to tell something.


--~--~-~--~~~---~--~~
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: JDO Best Practices

2009-11-03 Thread leszek

DM - http://vike.googlecode.com/svn/trunk/vike/src/br/com/ximp/vike/server...

Judging from above you don't use JPO but low level API. But your
entity class (Actor) is dressed with JDO annotations. I don't know
what will happen if entity dressed with JPA annotiation and beautified
by JDO enhancer will be persisted by low level API skipping JDO layer.

If you use JDO annotation use JDO API to manage your entities:

http://code.google.com/intl/pl/appengine/docs/java/gettingstarted/usingdatastore.html
--~--~-~--~~~---~--~~
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: Not sure I'm using Memcache properly

2009-10-29 Thread leszek

You mean Google App Engine/J implementation of this ?

http://code.google.com/intl/pl/appengine/docs/python/urlfetch/asynchronousrequests.html
--~--~-~--~~~---~--~~
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: Need help on how to enhance the data classes with netbeans

2009-10-29 Thread leszek

Thanks, I will try. I'm using eclipse only because of this Google
plugin, I'm rather fan of NetBeans.
--~--~-~--~~~---~--~~
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: JDO Unowned Relationship Issue

2009-10-29 Thread leszek

You have now:

  employee.addComputer(computer);
pm.close();

Replace with:

  employee.addComputer(computer);
  pm.makePersistent(employee);
  pm.close();

You update entity but don't persist it again.

Also replace:

  @Persistent
public SetLong computerKeys = new HashSetLong();

with:

@Persistent(defaultFetchGroup = true)
public SetLong computerKeys = new HashSetLong();

I'm not sure if method: employeeCheck.computerKeys.isEmpty())
launches lazy loading.
--~--~-~--~~~---~--~~
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: Deploy webservices

2009-10-29 Thread leszek

Follow this thread:

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/e29a06508797545c/b456c04790f20181?lnk=gstq=webservice#b456c04790f20181
--~--~-~--~~~---~--~~
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: Not sure I'm using Memcache properly

2009-10-28 Thread leszek

It looks ok, the only problem I can see that something can happen
between storing book in cache and getting book from cache.
Scenario like:
1) fetch book from Amazon and store in cache.
2)  book expires in Amazon (or any other event happens)
3) next request - get data from cache - you return status of the book
at the point 1), not the point 2).

But maybe this problem does not matter very much.

If you want to see if it is working simply use logging and watch the
log entries.
http://code.google.com/intl/pl/appengine/docs/java/runtime.html

I don't know if there is any method of sending request simultaneously
- maybe Amazon API supports some king of batch requests - but I'm
guessing only.

--~--~-~--~~~---~--~~
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: Concurrency In Transaction

2009-10-28 Thread leszek

http://code.google.com/intl/pl/appengine/docs/java/datastore/transactions.html

Look at the next code snippet

===
   for (int i = 0; i  NUM_RETRIES; i++) {
pm.currentTransaction().begin();

ClubMembers members = pm.getObjectById(ClubMembers.class,
k12345);
members.incrementCounterBy(1);

try {
pm.currentTransaction().commit();
break;

} catch (JDOCanRetryException ex) {
if (i == (NUM_RETRIES - 1)) {
throw ex;
}
}
}


In Google App Engine optimistic transaction model is applied. There
is no any global block, every request starts transaction but only
one is allowed to run through it, the second and next get and
exception and should run some logic to handle this exception. Here it
tries to rerun the transaction (hoping that the first already has
finished it)  You can also return error message to the client and
enable switch try again or any other rescue plan.
--~--~-~--~~~---~--~~
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: Weird Life Cycle of Servlet in GAE

2009-10-28 Thread leszek

Is it production or local (development) environment ?
--~--~-~--~~~---~--~~
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: Weird Life Cycle of Servlet in GAE

2009-10-28 Thread leszek

It is a clustered environment. So it is expected that the next request
is run on a different machine, JVM and all statics are reinitialized.
--~--~-~--~~~---~--~~
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: Storing and managing a collection of objects in a HttpSession.

2009-10-26 Thread leszek

http://code.google.com/intl/pl/appengine/docs/java/config/appconfig.html

===
App Engine includes an implementation of sessions, using the servlet
session interface. The implementation uses the App Engine datastore
and memcache to store session data.

This feature is off by default. To turn it on, add the following to
appengine-web.xml:

sessions-enabledtrue/sessions-enabled

The implementation creates datastore entities of the kind _ah_SESSION,
and memcache entries using keys with a prefix of _ahs.
==
--~--~-~--~~~---~--~~
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: primary key portability

2009-10-23 Thread leszek

I ported my Open Source EJB3/JPA application to Google App Engine many
months ago and almost at the beginning it was obvious that I had to
split my entity classes to two versions: Google App Engine and non
Google App Engine. Impossible to achieve 100% source compatibility.
Primary key not compatible is only the one element of the whole
story.

http://hoteljavaopensource.blogspot.com/2009/09/migration-to-google-app-engine.html
--~--~-~--~~~---~--~~
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: Problem with saving parent entity

2009-10-23 Thread leszek

It looks for me that you mix JPA annotations (OneToMany, Entity, Id)
with JDO api. - using PersistenceManager. It is hard to say how it
behaves and disentangle that issue.

But if you want to have bi-directional ownership - in News entity
Source instance - follow this thread, it could shed some light.

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/28d9c3b99df25e43/de54fff7bc059f11?lnk=gstq=snippet#de54fff7bc059f11
--~--~-~--~~~---~--~~
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: SimpleDS: an alternative for Datastore persistence

2009-10-23 Thread leszek

Do you have some more doc/java doc ? I was browsing through your page
and found nothing. As far as I caught you implemented simple set of
CRUD operations on items and simple query mechanism. Am I right ? The
decision to get rid of relationships is very sound because this GAE/J
implementation is rather like a bargain - it brings more troubles than
advantages. The only advantage of owned relationship is to persist
it under transactions - but you can achieve transactional behavior in
more straightforward way.
--~--~-~--~~~---~--~~
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: Possible to Add Child to Owned One to Many Relationship Without Loading All Children?

2009-10-21 Thread leszek

You hit the nail on the head. As far as I know there is nothing like
sequence in Google App Engine. Either you need to have another
entity with a counter and increase it in transactional way. Or you can
use memcache.

http://code.google.com/intl/pl/appengine/docs/java/javadoc/com/google/appengine/api/memcache/MemcacheService.html

There is a method:

java.lang.Long  increment(java.lang.Object key, long delta)
  Atomically fetches, increments, and stores a given integral
value.
---

Pay attention to atomically. May be this can be used for generating
sequential and avoid bottleneck in the case of datastore entity and
additional transaction. But because of the risk of memcache expiring
this method needs some more elaboration.
--~--~-~--~~~---~--~~
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: Servelts versus JSPS

2009-10-21 Thread leszek

JSP is nothing more than servlet code woven with html and some tags to
make generating html pages more easy. Almost everything you can do in
sevlet code you can do also in JSP page. So it is a design decision
what logic should be kept in JSP and what logic should tackled in a
classic servlet code.
I think that what you have written is very sound and follow MVC
approach. JSP should be responsible only for user interface (view
part) and be separated from any persistent logic, and servlet code
should keep model and control part and be separated from any
interface code. Servlet code should also be the only to communicate
with the persistence layer.

But why use pure JSP and servlet ? There are a lot of good frameworks
at hand.  There are successful stories with JSF 2.0 and Spring MVC
running gently with Google App Engine.

http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine?pli=1

Also GWT is running very nicely - I'm personally very fond of it. But
GWT is completely different, Ajax-style, approach.

--~--~-~--~~~---~--~~
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 fliter the child class based on parent class's property?

2009-10-21 Thread leszek

It is not possible, your query filter should contain only 'direct
attributes of the class. if you want to run query based on class
number you need to have to duplicate this property from Classroom to
Student.

But I don't understand your problem. If you have 'one to 'many'
relationship and want to run query on children based on parent
attributes than every time you will get all children connected with
that parent. So why not run query on parent class and collect all the
children.
--~--~-~--~~~---~--~~
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: Selecting more than 1000 rows ?

2009-10-20 Thread leszek

1000 is a hard limitation on every query. So if you have 5000
entitties and use range 999-1500 you will get only one record. The
only way is to iterate through entities using JDO extend.
--~--~-~--~~~---~--~~
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: Possible to Add Child to Owned One to Many Relationship Without Loading All Children?

2009-10-20 Thread leszek

I'm afraid that it is not possible.
But if the purpose of your relationship is only to manage child class
in a transactional way you don't need to keep them as a part of child
relationship.

Simply use Key type and set 'parent' part of the child' key being the
same and you can manage them in the same transaction.
--~--~-~--~~~---~--~~
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: Caching using static fields

2009-10-19 Thread leszek

What about using memcache as keeping cache version counter ? When
update is needed than this counter is increased. Every requests keeps
local number and at the beginning compare local counter against
memcache counter. If not equal than refresh local cache and local
cache number.
If memcache counter if not available (expired) than assume it as equal
0 and behave accordingly. It could mean unnecessary cache refreshing
from time to time if memcache expires.

--~--~-~--~~~---~--~~
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: JDO vs low level API

2009-09-24 Thread leszek

De gustibus non est disputandum - if you feel more comfortable with
low-level Api than with JDO/JPA Api it is up to you. You spent two
days trying to cope with Google App Engine JPA/JDO problem, I spent a
lot of sleepless nights migrating my EJB3/JPA application to Google
App Engine keeping backward compatibility (with success). But,
regardless this rather discouraging experience, I don't think that
recommending low-level Api as framework of choice is a good advice.
For me it is much more natural to think and talk using terms and
concepts like entity classes (typed), transactions,
relationships, properties, persistency - even with all
limitation forced by Google App Engine implementation - than
Entities (untyped), Key, Ancestors Key, filter predicate etc.
I don't think that there is any real advantage of using pure low-
level Api against JPA/JDO level. But, of course, I can imagine that
there could be some examples that handling with low level concepts in
more natural - for instance - if all you want is to keep some row data
identified only by keys and keys hierarchy.
But - please forget me - type of thinking: I cannot cope with some
JPA/JDO problems so I'm switching to low level API does not convince
me.
The only advantage I see is that you can use objects without all this
JPA/JDO dressing as TO objects - it is a real advantage, I fully agree
with that.

--~--~-~--~~~---~--~~
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: Delete all from datastore

2009-09-24 Thread leszek

If you want to clean your local datastore with respect to junit tests
- look at this link:

http://code.google.com/appengine/docs/java/howto/unittesting.html
--~--~-~--~~~---~--~~
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: Single transaction and makePersistentAll

2009-09-24 Thread leszek

Obviously it will not work, makePersistentAll is nothing more than:

for (Entity e : parameter_List) {
  em.makePersistent(e);
}
--~--~-~--~~~---~--~~
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: java swing api usage proble

2009-09-24 Thread leszek

You have to split your application into at least two parts: server
part (without any user interface related logic) and client side, user
interface. This client side can be java/swing (applet), or Java
Script, HTML, JSP etc.
--~--~-~--~~~---~--~~
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: How to location my service in Unit testing?

2009-09-23 Thread leszek

You need to have your data access method separated from servlet code
or RPC (if GWT is used) code.

Assume that you have something like:

class Customer  {

  private Key customerId;
...
}

class MyDataAccessService {

  public void addCustomer(Customer c) {
  ...
  }

and you want to test it.

You can create separate project for test (and link sources with main
project) or you can have test packages together with the main project.

So you write your test case (assuming Junit4)

public class TestCase1  {

  ...
  @Test
  public void testAddingCustomer() {
Customer c = new Customer();
c.setCustomerId(google);
...
MyDataAccessService service = new MyDataAccessService();
service.addCustomer(c);
// now test
PersistenceManager pm = ...
Customer c1 = pm.getObjectById(Customer.class, google);
assertNotNull(c1);
assertEquals(google,c1.getCustomerId);
..
}

Now you want to have this test enabled for local Google App Engine
environment.

Create classes us described under link and fix your test case.

http://code.google.com/appengine/docs/java/howto/unittesting.html

public class TestCase1 extends LocalDatastoreTestEnvironment {

   @Before
   public void setUp() {
 super.setUp();
   }

   @After
   public void tearDown() {
 super.tearDown();
   }

   @Test
   public void testAddingCustomer() {
   ..


}

Now you can run TestCase1 as standard Junit Test (from Eclipse) and be
happy.

Addtional remark:
You can avoid extending your TestCase and use simple composition.

class TestCase {


   LocalDatastoreTestEnvironment localStore = new
LocalDatastoreTestEnvironment();

   @Before
   public void setUp() {
 localStore.setUp();
   }

   @After
   public void tearDown() {
 localStore.tearDown();
   }

Also you can change it anyway as you like and best fit to your
purpose.

Treat what is under link as a demo how this stuff is running, not as a
dogma.


--~--~-~--~~~---~--~~
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: Type Owned by Two Different Types?

2009-09-21 Thread leszek

That's very interesting because it works for me:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Employee {

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

private String firstName;

private String lastName;

}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class A (B) {

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Employee getE() {
return e;
}

public void setE(Employee e) {
this.e = e;
}

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
}


(regardless if transaction is used or not - simply makePersistent
without transaction)

PersistenceManager em = EMF.get().getPersistenceManager();
Employee e = null;
try {
em.currentTransaction().begin();
A a = new A();
e = new Employee();
a.setE(e);
em.makePersistent(a);
em.currentTransaction().commit();
} catch (Exception ee) {
em.currentTransaction().rollback();
}


try {
em.currentTransaction().begin();
B b = new B();
//  e = new Employee();
b.setE(e);
em.makePersistent(b);
em.currentTransaction().commit();
} catch (Exception ee) {
em.currentTransaction().rollback();
}

--~--~-~--~~~---~--~~
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: Problem with JDO - Attempt was made to manually set the id component of a Key primary key

2009-09-18 Thread leszek

Could you provide more details, how your entity class looks like and
how it is persisted ?
--~--~-~--~~~---~--~~
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: date between jdo query

2009-09-18 Thread leszek

Could you provide more details how your failing query looks like ?
--~--~-~--~~~---~--~~
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: Problem with JDO - Attempt was made to manually set the id component of a Key primary key

2009-09-18 Thread leszek

There is nothing wrong with that, it should work. Could you past also
a persiting sequence, where this exception is thrown.
--~--~-~--~~~---~--~~
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: Accessing Memcache in more than one servlet

2009-09-18 Thread leszek

The second. If you get an object from the cache you have the
serialized copy of the object. So to make your changes persistent
and visible by the other requests you have to put it into the cache
again. Also to have a fresh object you have to get it again. What
you have is a reference to the serialized copy of the object inside
the cache, not the reference to the object itself.
--~--~-~--~~~---~--~~
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: Unicode problems

2009-09-17 Thread leszek

I'm using GWT on the client side.
--~--~-~--~~~---~--~~
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: self referral one-to-many relationship with null root

2009-09-17 Thread leszek

Follow this thread:
http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/3affdf1441f864b6/47e35ad2811de108?lnk=gstq=self#47e35ad2811de108

It looks like known issue.
--~--~-~--~~~---~--~~
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: RPC call and variables

2009-09-16 Thread leszek

Follow this thread - could be helpful

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/d816992c5a82506b/e50b4eb988d2f45b?lnk=gstq=comet#e50b4eb988d2f45b
--~--~-~--~~~---~--~~
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 I avoid Data Nucleus and still use JPA?

2009-09-15 Thread leszek

Nobody can contradict that DataNucleus is a high quality software. The
fact that it is Google's persistence provider of choice speaks for
itself.
--~--~-~--~~~---~--~~
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: Regarding debugging error

2009-09-15 Thread leszek

Replace:
   filter-classAuthFilter/filter-class
With
filter-classcom.org.login.AuthFilter/filter-class
--~--~-~--~~~---~--~~
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: RPC call and variables

2009-09-15 Thread leszek

It is a clustered environment and you cannot assume that every request
is run in the JVM. If you want to share data between requests you
should persist them (data) in datastore.
--~--~-~--~~~---~--~~
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 I avoid Data Nucleus and still use JPA?

2009-09-14 Thread leszek

Hibernate is not JPA implementation, it exposes its own API.
Hibernate Entity Manager is a product build on standard Hibernate
and offering full JPA interface.

Google App Engine does not support Hibernate:
http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine
-
Hibernate
Versions: All
Status: INCOMPATIBLE

* You cannot currently use Hibernate directly. The differences
between the App Engine datastore and SQL were too great to get the
standard Hibernate up and running under App Engine. App Engine does
support JDO and JPA, so you may be able to convert your Hibernate code
to use one of these ORM interfaces.
-
--~--~-~--~~~---~--~~
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: Create different entity (Database) for each user.

2009-09-14 Thread leszek

Look at this thread, may provide some useful information.

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/6ae2e6737cbb4b40/f47f015099538467?lnk=gstq=administrator#f47f015099538467
--~--~-~--~~~---~--~~
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] Migration to Google App Engine for Java

2009-09-14 Thread leszek

Some thoughts based on experience.

http://hoteljavaopensource.blogspot.com/2009/09/migration-to-google-app-engine.html
--~--~-~--~~~---~--~~
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: Own Login system

2009-09-10 Thread leszek

Why not create simple CRUD for keeping log-id and password and
simple dialog to get login id and password and check against persisted
class being managed by this CRUD. It could be a good starting point.
--~--~-~--~~~---~--~~
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: Tomcat Instead of Jetty.

2009-09-10 Thread leszek

But do you mean GWT or Google App Engine application ?

GWT comes with embedded tomcat to keep backward compatiblity. Although
there is a warning that it is deprecated and can be deleted in the
future.

If you want to use tomcat simply start shell as it is described in
documentation for GWT 1.5 (or earlier).
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=DevGuideHostedMode.

GWT application (without Google App Engine) can be run inside any
container, just deploy it as a normal .war module.

Google App Engine comes with its own embedded web server which cannot
be switched.

But what is used in the case of GWT/Google App Engine application and
GWT running in hosted mode started to use deprecated tomcat ? Good
question - I don't know what is the relationship between embedded GWT
server running in hosted mode and embedded Google App Engine server.
--~--~-~--~~~---~--~~
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: Initializing Datastore

2009-09-09 Thread leszek

But what you mean by real application ? If you want to have a server
part of your application and client part running outside Google App
Engine you can implement access to the server part and Google App
Engine datastore via servlet and standard GET/POST request.

http://code.google.com/appengine/docs/java/runtime.html#Requests_and_Servlets


--~--~-~--~~~---~--~~
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: testing persistence with one to many relashionship

2009-09-09 Thread leszek

It works for me.

I have something like:

class Employee {
...
@Persistent(mappedBy=employee)
private ListContactInfo contactInfo;
.. }

class ContactInfo {

   @PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
...}

than:
   Employee e;
   ...
PersistenceManager pm = PMF.get().getPersistenceManager();

Transaction tx = pm.currentTransaction();
try {
tx.begin();
pm.makePersistent(e);
for (ContactInfo co : e.getContactInfo()) {
System.out.println(co.getKey());

}
tx.commit();
  }
..

and it works as expected.

Could you provide more details ?
--~--~-~--~~~---~--~~
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: Problem saving an object using makePersistent

2009-09-09 Thread leszek

Replace:
@Persistent
with:
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)

Otherwise provide some code how you call the method
  public void saveUser(User user)   (I'm guessing that this method
throws exception).

particulary how the 'user' parameter is created.


--~--~-~--~~~---~--~~
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: Master/Detail relations and redundant data handling

2009-09-07 Thread leszek

I'm not sure if your taking of the problem is correct. To my mind it
runs:

You have Company and Employee. Company has many Employees and Employee
is working for one company. Normalized version looks like:

class Company {

   @Persistent private String companyName;
   @Persistent private String businessArea;
...
}

class Employee {

  @Persistent private String name;
  @Persistent private String address;
  
  @ManyToOne
  private Company company;
}

If you want to get all Employess working for a company you should
execute:
  SELECT * FROM Employee e WHERE e.company.companyName = :nameParam

or if you want all Emloyees working for all IT companies you execute:
  SELECT * FROM Employee e WHERE e.company.businessArea = 'IT' 
...
But this query will not work in Google App Engine.

The solution is to resolve this query programmaticaly by running
several queries and filter it in memory or to denormalize this
scheme by moving some fields from Company to Employee

Something like:

class Epmloyee {
  @Persistent String name;
  @Persistent String address;

  // copy of property fiels from Company
  @Persistent private String companyName;
  @Persistent private String businessArea;

  @ManyToOne
  private Company company;
}

and run
  SELECT Object(Employee) FROM Employee e WHERE e.companyName
= :nameParam

The first solution allows keeping normalized version but the cost is
less effective query, the second requires to break strictly normalized
pattern but the query is much more effective (I think that it can be
10 or more times more effective). Also the second solution requires
more time while writing and updating.
But it is up to you what is more important, it is classical dilemma:
more reads or more writes.

--~--~-~--~~~---~--~~
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: JDO queries on owned/unowned one-to-many relationships

2009-09-04 Thread leszek

You can run queries on keys:

http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Queries_on_Keys

The first part of child key (ContactInfo.class) contains parent
(Employee) key.

 Employee e;
 

 query = pm.newQuery(ContactInfo.class);
 query.setFilter(key == keyParam);
 query.declareParameters(com.google.appengine.api.datastore.Key
keyParam);
 Key key = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
());
 list = (ListContactInfo) query.execute(key);

But it returns empty list because the second part of child key
contains child key itself, so it is never equal.

Maybe something like that will work (assuming that your goal is to
find all child belonging to single parent).

 query = pm.newQuery(ContactInfo.class);
 query.setFilter(key  keyParam and key  keyParam1);
 query.declareParameters(com.google.appengine.api.datastore.Key
keyParam);
 query.declareParameters(com.google.appengine.api.datastore.Key
keyParam1);
 Key key = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
());
 Key key1 = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
() + 1);
 list = (ListContactInfo) query.execute(key,key1);


--~--~-~--~~~---~--~~
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: JDO queries on owned/unowned one-to-many relationships

2009-09-04 Thread leszek


 query.setFilter(key  keyParam and key  keyParam1);
--~--~-~--~~~---~--~~
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: HttpSession handling question

2009-09-03 Thread leszek

Have you enabled session ? By default it is read-only.

WEB-INF/appengine-web.xml.

sessions-enabledtrue/sessions-enabled

http://code.google.com/appengine/docs/java/config/appconfig.html

---
Enabling Sessions

App Engine includes an implementation of sessions, using the servlet
session interface. The implementation uses the App Engine datastore
and memcache to store session data.

This feature is off by default. To turn it on, add the following to
appengine-web.xml:

sessions-enabledtrue/sessions-enabled

-
--~--~-~--~~~---~--~~
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: How to make a isKeysOnly() query in JDO?

2009-09-03 Thread leszek

But how do you want to accomplish it ? There is no query like give me
the next no more than 1000 keys using filter key  lastkey.  Also
there is no query like give me the least key using filter key 
lastkey.
--~--~-~--~~~---~--~~
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: who can help me

2009-09-02 Thread leszek

Look into this file: WEB-INF/web.xml. It looks like XML-syntax problem.
--~--~-~--~~~---~--~~
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: A matter in local time

2009-09-02 Thread leszek

If you delete double declaration (String formattedDate) and add proper
imports and declaration  'Calendar cal = Calendar.getInstance()); it
should work.
But you are having this problem while running in local  environment
(in your machine) or it does not work after deploying to google
(production) environment ?
--~--~-~--~~~---~--~~
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: self join in google app engine

2009-09-02 Thread leszek

Read this thread - could be helpfull :

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/3affdf1441f864b6/99a166946ad0ef61?lnk=gstq=self#99a166946ad0ef61


--~--~-~--~~~---~--~~
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: Unowned relationships

2009-09-01 Thread leszek

You can follow something like that

class Parent {
  
  @Persistent
  private ListLong/Key childList;

  // non Persistent
  private ListChild list;
  ...
}

class Child {

   @PrimaryKey
   private Long/Key key;
   ...
}

// before save Parent
  private void beforeSave(EntityManager em,Parent pa) {
 if (pa.getList() != null) {
   ListLong chList = new ArrayListLong();
   for (Child ch : pa.getList) {
 pm.makePersistent(ch);
 pm.flush();
 chList.add(ch.getKey());
   }
   pa.setChildList(chList);
}
  }

  private void afterLoad(EntityManager em,Parent pa)  {
ListChild chList = new ArrayListChild();
for (Long key : pa.getChildList()) {
   Child ch = pm.getObjectById(Child.class,key);
   chList.add(ch);
}
pa.setList(chList);
  }


  PersistenManager pm;
  

  // main service
  Parent pa = pm..getObjectById(...)
  afterLoad(pm,pa);
  ...
  ...
  beforeSave(pm,pa);
  pm.makePersistent(pa);

  ListParent pList = pm.queryExecute();
  for (Parent pa : pList) {
afterLoad(pm,pa);
  }
  ...
  // etc

In order to avoid repeating the same beforeSave and afterLoad for all
Entity classes having onowned relationship you can apply Annotation
and, by  the use of reflection, develop generic approach for all
classes having this feature.




--~--~-~--~~~---~--~~
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: i have create a gwt project ,now when deploy the project with gae ,some problem has appear

2009-09-01 Thread leszek

It is a common problem. Read this thread:

http://groups.google.co.uk/group/google-appengine-java/browse_frm/thread/bce6630a3f01f23a/62cb1c4d38cc06c7?lnk=gstq=com.google.gwt.user.client.rpc.SerializationException%3A+Type+%27org.datanucleus.store.appengine.query.StreamingQueryResult%27+was+not+included+in+the+set+of+types+which+can+be+serialized+by+this+SerializationPolicy
--~--~-~--~~~---~--~~
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: Using external jars

2009-09-01 Thread leszek

But what class cannot be found ? Are you sure that you have put
flexjson and all necessary jars in WEB-INF/lib directory of your
project ?


--~--~-~--~~~---~--~~
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: Exception on creation of java.io.File in GAE

2009-08-31 Thread leszek

http://code.google.com/appengine/docs/java/config/appconfig.html

May be you find there the solution, but I'm guessing only.
--~--~-~--~~~---~--~~
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: jdo date

2009-08-29 Thread leszek

Hm Could you elaborate a little more on that ?


--~--~-~--~~~---~--~~
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: issue about JDO Relationship in JUnit

2009-08-29 Thread leszek

But what you have while running this assert ? I dare say that
p2.getSentences.size() is 0 at that moment.
--~--~-~--~~~---~--~~
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: jdo date

2009-08-29 Thread leszek

You are right, but 'midomarocain'' wants to keep full date (with hours/
min/secs) and in one context compare the full date and in the another
context compare the same date but using the year/month/day part only.
But, of course, it is possible to split the date to java.sql.Date and
java.sql.Time and once compare the java.sqlDate  only and else compare
java.sql.Date and java.sql.Time.

But unfortunately GAE does not support that:

http://code.google.com/intl/pl/appengine/docs/java/datastore/queriesandindexes.html

-
Due to the way the App Engine datastore executes queries, a single
query cannot use inequality filters ( = = ) on more than one
property. Multiple inequality filters on the same property (such as
querying for a range of values) are permitted. See Restrictions on
Queries.
-

I hope that we are on the same page now.


--~--~-~--~~~---~--~~
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: Getting a child from it's parent

2009-08-28 Thread leszek

http://code.google.com/appengine/docs/java/datastore/relationships.html

=
Child objects are loaded from the datastore when they are accessed for
the first time. If you do not access the child object on a parent
object, the entity for the child object is never loaded. (The
datastore interface does not support the eager loading of child
objects. The datastore does not support join queries, so an
implementation of eager loading wouldn't save the app a call to the
datastore.)
=

But it works only if the parent is attached to PersistentManager
(before 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: Getting a child from it's parent

2009-08-28 Thread leszek

You have to touch child field while the parent is still managed by
PersistenceManager, before detaching (pm.close).

Something like:

PersistenceManager pm = PMF.get().getPersistenceManager();
try {
Employee e = pm.getObjectById(Employee.class, id);
ContactInfo i = e.getContactInfo();
return e;
} 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: deployment issues

2009-08-28 Thread leszek

Look here: http://code.google.com/status/appengine

It seems that GAE Java was having some problems yesterday. Error 500
suggests some problems on the server side. But I'm guessing only.
--~--~-~--~~~---~--~~
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: is not that of an entity but needs to be for this operation when persist entity

2009-08-28 Thread leszek

What you mean by:

--
I get this error (only on GAE enviroment, because on my local
development IDE work ok)...
-

You mean that your code works while running on local datastore and not
work after deploying to the google (production) environment ?
--~--~-~--~~~---~--~~
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: jdo date

2009-08-28 Thread leszek

Look at:

http://www.jpox.org/docs/1_1/query_jdoql_methods.html

But I cannot tell if it is supported in GAE plugin for DataNucleus.


--~--~-~--~~~---~--~~
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: jdo date

2009-08-28 Thread leszek

Try also with two Date fields - the second keeping the year/month/date
part only

Something like:

// Entity

@Persistent
 private Date birthDate;

 @Persistent
 private Date birthDateOnly;

   public void setBirthDate(Date birthDate) {
  this.birthDate = birthDate;
  if (birthDate != null) {
  this.birthDateOnly = new Date(birthDate.getYear(),birthDate.getMonth
(),birthDate.getDate());}
  }
  }

// query

ListObject... li;
Query query = pm.newQuery(Object...class);
query.setFilter(birthDateOnly == birthDateParam);
query.declareParameters(Date birthDateParam);
   query.declareImports(import java.util.Date);

   try {
  li = (ListObject..) query.execute(new Date(100,10,15));
  }
...


--~--~-~--~~~---~--~~
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: I don't understand Relationships managed by JDO and Datanucleus in GAE

2009-08-24 Thread leszek

http://code.google.com/appengine/docs/java/datastore/relationships.html#Dependent_Children_and_Cascading_Deletes

-
Dependent Children and Cascading Deletes

The App Engine implementation of JDO makes all owned relationships
dependent. If a parent object is deleted, all child objects are also
deleted. Breaking an owned relationship by assigning a new value to
the dependent field on the parent also deletes the old child.

As with creating and updating objects, if you need every delete in a
cascading delete to occur in a single atomic action, you must perform
the delete in a transaction.
--
So your:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class MobilePhone implements IsSerializable {

  @Persistent(dependent = false)
  private User creator;
.

is regarded as 'MobilePhone' being the owner of the 'User' what is you
don't expected.

If you want to keep 'non-owned' relationship between 'MobilePhone' and
'User' than the best way is simply keep the key of the User in
MobilePhone and  to handle is manually.


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class MobilePhone implements IsSerializable {

  @Persistent
  private Key creator;
.


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