[appengine-java] Re: gae.parent-pk doesnt work in list query

2011-09-15 Thread lp
i raised it as an issue as i am unable to get resolution.

http://code.google.com/p/googleappengine/issues/detail?id=5897

vote if u has a similar problem.

-lp

-- 
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: gae.parent-pk doesnt work in list query

2011-08-15 Thread lp

On Aug 15, 6:09 pm, datanucleus andy_jeffer...@yahoo.com wrote:
  however i have the following issues.

  1.I am using the query  Select c from ChatUser c where c.key =:keyList
  elsewhere and it is working fine. How can it be working?

 Because Google didn't respect valid JDOQL when they implemented their
 plugin and allowed nonsense like that query (the syntax is GQL). For
 portability you should never use it.

fair enough.

But when i use a normal key field everything works. any ideas?
   @Basic
   private Key parentKey2;
Query chatUserQuery = em.createQuery(Select c from ChatUser c where
c.parentKey2 IN (:parentKeyList));

 The log tells you plenty about the query, and just wish people could
 refer to it.

i got logging set to DEBUG.
all i see in my logs is the following.
is there something in my logging that i have missed?

18:21:31,184 DEBUG [DataNucleus.Query] - JPQL Single-String with
Select c from ChatUser c where c.parentKey IN (:parentKeyList)
18:21:31,197 DEBUG [DataNucleus.Query] - JPQL Query : Compiling
SELECT c FROM ChatUser c WHERE c.parentKey IN (:parentKeyList)
18:21:31,206 DEBUG [DataNucleus.ClassLoading] - Class
java.lang.ChatUser was not found in the CLASSPATH [Class resolver
called from org.datanucleus.util.Imports.resolveClassDeclaration
(line=177)]
18:21:31,206 DEBUG [DataNucleus.ClassLoading] - Class
java.lang.ChatUser was not found in the CLASSPATH [Class resolver
called from org.datanucleus.util.Imports.resolveClassDeclaration
(line=177)]
18:21:31,215 DEBUG [DataNucleus.Query] - JPQL Query : Compile Time =
18 ms
18:21:31,217 DEBUG [DataNucleus.Query] - DATASTORE Query : Executing
SELECT c FROM ChatUser c WHERE c.parentKey IN (:parentKeyList) ...

thanks

-lp

-- 
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: gae.parent-pk doesnt work in list query

2011-08-14 Thread lp

On Aug 12, 7:03 pm, datanucleus andy_jeffer...@yahoo.com wrote:
 Invalid JPQL (a Key cannot equal a List). This makes more sense
 Select c from ChatUser c where c.parentKey IN :parentKey

thanks for the response.

however i have the following issues.

1.I am using the query  Select c from ChatUser c where c.key =:keyList
elsewhere and it is working fine. How can it be working?

2. When i run the IN i get the following error.
org.datanucleus.store.appengine.query.DatastoreQuery
$UnsupportedDatastoreFeatureException: Problem with query SELECT c
FROM ChatUser c WHERE c.parentKey IN :parentKeyList: Unexpected
expression type while parsing query:
org.datanucleus.query.expression.SubqueryExpression

have got these queries completely wrong?

-lp

-- 
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: gae.parent-pk doesnt work in list query

2011-08-14 Thread lp
 1.I am using the query  Select c from ChatUser c where c.key =:keyList
 elsewhere and it is working fine. How can it be working?

i now concerned how the above query can work.
i assumed it was producing an IN/OR query, hence limited by 30 OR
statements.
however unit testing in the development environment shows that i can
run over 130 elements in the List parameter without any fault
generation.
ie
  ListKey parentList = new ArrayListKey();
   parentList.add(user1.getKey());
   parentList.add(user2.getKey());
   for( int i=0; i130; i++){
   parentList.add(KeyFactory.createKey(ChatUser.CLASS_NAME, i
+11) );
   }

what i thought i understood is now very confusing.

-lp

-- 
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: gae.parent-pk doesnt work in list query

2011-08-14 Thread lp
On Aug 12, 7:03 pm, datanucleus andy_jeffer...@yahoo.com wrote:
 Invalid JPQL (a Key cannot equal a List). This makes more sense
 Select c from ChatUser c where c.parentKey IN :parentKey

i tried the IN clause it get the same error.

   @Basic
   @Extension(vendorName=datanucleus, key=gae.parent-pk, value =
true)
   private Key parentKey;

Query chatUserQuery = em.createQuery(Select c from ChatUser c where
c.parentKey IN (:parentKeyList));

produces error
java.lang.ClassCastException: java.util.ArrayList cannot be cast to
com.google.appengine.api.datastore.Key
at
org.datanucleus.store.appengine.query.DatastoreQuery.internalPkToKey(DatastoreQuery.java:
1484)


But when i use a normal key field everything works.
   @Basic
   private Key parentKey2;

Query chatUserQuery = em.createQuery(Select c from ChatUser c where
c.parentKey2 IN (:parentKeyList));

the issue seems to be with the gae.parent-pk not the query.

-lp

-- 
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] gae.parent-pk doesnt work in list query

2011-08-12 Thread lp
hi all

when i try to query using the gae.parent-pk IN a list, it is failing
with a ClassCastException below. i can use the parent key in a query
for a single value fine.

any ideas why this doesnt work?


java.lang.ClassCastException: java.util.ArrayList cannot be cast to
com.google.appengine.api.datastore.Key
at
org.datanucleus.store.appengine.query.DatastoreQuery.internalPkToKey(DatastoreQuery.java:
14

this is the query
---
Query chatUserQuery = em.createQuery(Select c from ChatUser c where
c.parentKey=:parentKey);
chatUserQuery.setParameter(parentKey, keyList);
chatUserList = (ListChatUser) chatUserQuery.getResultList();

this is the JPA
--
public class ChatUser {

public static final String CLASS_NAME = ChatUser;
public static final String FIND_BY_PARENT_KEY =
ChatUser.findByParentKey;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;

@Basic
@Extension(vendorName=datanucleus, key=gae.parent-pk, value =
true)
private Key parentKey;

}


-lp

-- 
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] sdk 1.5.2 removes exploding indexes!!!

2011-07-26 Thread lp
has anyone read this.

http://googleappengine.blogspot.com/2011/07/app-engine-152-sdk-released.html

Advanced Query Planning - We are removing the need for exploding indexes and 
reducing the custom index requirements for many queries. The SDK will 
suggest better indexes in several cases and an upcoming article will 
describe what further optimizations are possible.


i havent tried it out yet but i wanna see if it reduces my write cost on 
list properties.

-lp 

-- 
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/-/uli40PUyGqIJ.
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: DataStore Statistics not updated for at least 2 days

2011-07-17 Thread lp
magic.
the statistics have been updated.

thanks mr google.
-lp

-- 
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/-/HvDe2orXucgJ.
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] DataStore Statistics not updated for at least 2 days

2011-07-15 Thread lp
hi all

the database stats have NOT been updated for at least 2 days.

it says last updated 19:10:27 but clear what day it happened.

what can be done to get them updated?

-lp

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



[google-appengine] XMPP and user registration

2011-07-04 Thread lp
hi all

after reading the GAE XMPP API i cant find what i am looking for.

i require my server to register a user with a third party XMPP server.

however i cant see any mechanism of achieving this with/out the GAE XMPP 
API.

Problem 1.
there is no connection/authentication to external XMPP server in API.
Problem 2. 
3rd party XMPP libraries are using TCP sockets will not work in GAE.
 
Question.
How can i register a user from a GAE application?

thanks

-lp

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/4IFLHzGk1FUJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: overcome onetomany limitation of 5000

2011-05-29 Thread lp
thanks guys for your suggestions.

but having a separate entity holding the foreign key will make updates
unusable for even moderate size relationships 1000.

i have used essentially the same approach suggested by nicole but each
'relational' entity will hold a list of foreign keys rather than a
single key.
this makes update significantly faster as i have less relational
entities to update.

This provides a solution to what google appengine guys call 'fan out
problem'.

hope this helps others.

-lp

-- 
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] overcome onetomany limitation of 5000

2011-05-12 Thread lp
hi all
i am modelling a unowned one-to-many relationship using list properties. 

@Entity
public class User{

String name;

Boolean loggedIn;

@Basic
private ListKey friends;
}

all is good. i can run queries like 

query = Select p from PositionUser p where p.friends = :userKey and  +
AND p.loggedIn = true  

However there is a limit on the number of index available per entity of 
5000. (although i am hitting the limit at 2500 for some reason)

 i have 2 problems with the current approach

#1. below the 5000 limit each addition to the friend list will require a 
fetch of the entire list, then add item and then put to datastore.
this is rather expensive in CPU.

#2. How can i allow for 5000 in the onetomany?

any suggestion pls

-lp

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



[google-appengine] Re: maximum number of values in all indexes for an entity -what is it?

2011-05-10 Thread lp
yeap the production server is different to the dev environment.

i am getting the following error in prod when adding a to a list of 2500 to 
the entity.

: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 
1: Too many indexed properties for entity: app: 

however this is well short of the 5000 hard limit advertised.

any idea where the other 2500 indexes are being used?

-lp

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] maximum number of values in all indexes for an entity -what is it?

2011-05-09 Thread lp
hi guys 
i am attempting to understand the limits below.

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


 Limit  
 
  maximum entity size 1 megabyte  maximum number of values in all indexes 
for an entity (1) 5,000 values  
   
   1. An entity uses one value in an index for every column × every row that 
   refers to the entity, in all indexes. The number of index values for an 
   entity can grow large if an indexed property has multiple values, requiring 
   multiple rows with repeated values in the table.





i am not sure what it means. 

i thought the limit would apply to list properties, but my test of 5002 
elements in a list was successful in the 
dev environment.

any help in clarifying what the limit means is helpful

thanks

-lp

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: NoResultException causes rollback transaction why?

2011-03-25 Thread lp
ok this looks like Spring transaction issue.

when the @Transactional is removed the NoResultException does not affect the 
commit.


this is f#$$

-lp

-- 
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] NoResultException causes rollback transaction why?

2011-03-24 Thread lp
guys

in my JPA code a NoResultException causes the transaction to be rollback.

i am using the spring txn manger but all JPA methods are @Transactional( 
propagation=Propagation.NOT_SUPPORTED).


any help pls.


@Transactional( propagation=Propagation.NOT_SUPPORTED)
public void txnMethod( CollectionLong list) throws 
ApplicationExecption{

for (IteratorLong iterator = list.iterator(); iterator.hasNext();) 
{
Long fbId = iterator.next();
PositionUser user = null;
final Query query = 
em.createNamedQuery(PositionUser.FIND_BY_FB_ID);
query.setParameter(facebookId, fbId);
try {
user = (PositionUser) query.getSingleResult();
}
   catch (NoResultException e) {
log.info( error occured: + e.toString() );
}catch (NonUniqueResultException e) {
throw new ApplicationExecption(e);
}

if(user!= null) {
ListKey friends = user.getFriends();
PositionUser findUser = em.find(PositionUser.class, 
friends.get(0));
findUser.getFriends().remove(user.getKey());

em.merge(findUser);
}
em.remove(user);
}
}


-lp

-- 
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: NoResultException causes rollback transaction why?

2011-03-24 Thread lp
that previous example code was too complex... phew it was a late night

this a simpler example of the a method that does a rollback when a 
NoResultException is thrown.

even if the exception is handled it doesnt matter the txn is rollback and no 
commits are done.

if the NoResultException is NOT thrown the method commits correctly.

is this voodoo or something?


@Transactional( propagation=Propagation.NOT_SUPPORTED)
public void txnMethod( CollectionLong list) throws 
ApplicationExecption{

for (IteratorLong iterator = list.iterator(); iterator.hasNext();) 
{
Long fbId = iterator.next();
PositionUser user = null;
final Query query = 
em.createNamedQuery(PositionUser.FIND_BY_FB_ID);
query.setParameter(facebookId, fbId);
try {
user = (PositionUser) query.getSingleResult();
}
   catch (NoResultException e) {
log.info( error occured: + e.toString() );
}catch (NonUniqueResultException e) {
throw new ApplicationExecption(e);
}

if(user!= null) {
user.setAccuracy(5000);
em.merge(user);
}
}

}

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



[google-appengine] Re: High CPU Warning - Is it really an issue?

2011-03-11 Thread lp
 So my question is, should I be concerned at the high CPU warnings or
 is it something most people experience?


i am getting similar CPU times and very similar elapsed times as u.

but i get large variation in my CPU times for no apparent reason
( same query, params).
i am using 'Always-on' so it cant be warm up request.

all that i am concerned about is my elapsed time and my quota cost for
scalability. so far so it can scale.


-lp

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: stdout in my logs

2011-03-08 Thread lp

 #
 I 2011-03-06 20:14:32.566 [minglegeo/1.348824067992053184].stdout:
 04

strangely they are not present in my dev environment.

any one getting a similar 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: Hosting Java application

2011-03-08 Thread lp
 Sorry for the stupid noob question. I'm creating a Java Application that use
 several libraries and basically gets streams from twitter and somehow use
 them to save jpg images. I wonder if Google App Engine is what I need to
 keep my application running without need to run it on my computer
 permanently. And is it possible to do that at all?

the only out bound connections available on appengine are http.
so if twitter supports http, all good.

saving images no problem

hope that helps.

-lp

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



[google-appengine] is paid support available?

2011-03-08 Thread lp
hi all,

is paid support for appengine available?

thanks

-lp

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Request CPU variance with 'Always-on'

2011-03-08 Thread lp
hi all,

i have getting large variance in my request and api cpu on a java app.

I have read the countless articles on the topic and the quota doc.

what i am seeing is *not* do to process startup as i have 'Always on'
enabled since there is no more of the ' This request required a
process to startup.

Below are a sample of the logs for the same query within 15 minutes.

2011-03-07 22:07:56.183 /fbconnect/update 200 157ms 518cpu_ms
261api_cpu_ms
2011-03-07 22:06:18.738 /fbconnect/update 200 310ms 611cpu_ms
261api_cpu_ms
2011-03-07 21:56:23.973 /fbconnect/update 200 309ms 518cpu_ms
261api_cpu_ms
2011-03-07 21:51:55.193 /fbconnect/update 200 663ms 985cpu_ms
261api_cpu_ms
2011-03-07 21:50:30.879 /fbconnect/update 200 157ms 448cpu_ms
261api_cpu_ms

2011-03-07 23:06:10.153 /fbconnect/update?id=37002 200 326ms
1862cpu_ms 1652api_cpu_ms
2011-03-07 23:02:28.721 /fbconnect/update?id=37002 200 347ms
1842cpu_ms 1585api_cpu_ms
2011-03-07 23:02:28.675 /fbconnect/update?id=37002 200 217ms 506cpu_ms
156api_cpu_ms
2011-03-07 22:53:08.199 /fbconnect/update?id=37002 200 737ms
2135cpu_ms 1585api_cpu_ms 2kb Mingle/1.1.1.3 CFNetwork/485.12.7

what is going on is my app really written that dodgy?
the same query is being executed each time but the results have an
enormous variance on the elapsed time and request cpu.

I have profiled my code and i can see where the variations are
happening but it is in JPA calls like em.find, em.merge which are
fairly basic stuff.

Q1.what is causing this variance... my code or appengine accounting?

any help is most welcome.



-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[appengine-java] Re: Need Help in Unit Testing (How to convert btw Entity and JDO class)

2011-03-07 Thread lp
i havent unit tested with JDO but with JPA.
But i expect it to work the same.

the example on the 
http://code.google.com/appengine/docs/java/tools/localunittesting.html
is using the datastoreService, since u are using JDO u will need a
persistence manager.

no need for 'Entity' just use JDO or JPA.

The magic is done by the LocalServiceTestHelper.setup

so your problem is the error  below

java.lang.NullPointerException: No API environment is registered for
this thread.

This means there is no datastore attached to your pm.

Post your code for test setup and pm initialisation.

-lp

-- 
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] Request CPU variance with 'Always-on'

2011-03-07 Thread lp
hi all,

i have getting large variance in my request and api cpu.

I have read the countless articles on the topic and the quota doc.

what i am seeing is *not* do to process startup as i have 'Always on'
enabled since there is no more of the ' This request required a
process to startup.

Below are a sample of the logs for the same query within 15 minutes.

2011-03-07 22:07:56.183 /fbconnect/update 200 157ms 518cpu_ms
261api_cpu_ms
2011-03-07 22:06:18.738 /fbconnect/update 200 310ms 611cpu_ms
261api_cpu_ms
2011-03-07 21:56:23.973 /fbconnect/update 200 309ms 518cpu_ms
261api_cpu_ms
2011-03-07 21:51:55.193 /fbconnect/update 200 663ms 985cpu_ms
261api_cpu_ms
2011-03-07 21:50:30.879 /fbconnect/update 200 157ms 448cpu_ms
261api_cpu_ms

the same query is being executed each time but the results have an
enormous variance on the elapsed time and request cpu.

Q1.what is causing this variance... my code or appengine accounting?

On the positive the api cpu is constant at 261.

any help is most welcome.

-- 
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: appcfg deployment hangs at jsp compile

2011-03-06 Thread lp
ok got to the bottom of this.

it seems that the javac wasnt hung, just runing slow. about 60 s/
jsp page.

by removing the datanucleus-enhancer-1.1.4.jar from my WEB-INF/lib the
problem was resolved.

i guess datanuclues jars should be in there but what a waste of 8
hours ;-(

hope this help another.


-lp

-- 
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] stdout in my logs

2011-03-06 Thread lp
hi all

i am getting loads of the following trace in my logs.

#
I 2011-03-06 20:14:32.566 [minglegeo/1.348824067992053184].stdout:
04

for each request i get about 30 lines of this stuff. why?

i dont know what is causing it to be generated?

i have searched for System.out but i am only using log.info, error
etc.

any ideas?

-lp

-- 
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 do fast write datastore, google io 2008

2011-03-05 Thread lp
 2. how to combine the results from all these classes and list the
 comments by date? I dont understanding this part. any sample code on
 this?

you will need 3 queries.
one query for each entity.
each queries will need to be executed individualy.

ie (puesdo code)

pm.execute(select c.text from CommentA c where date=?)
pm.execute(select c.text from CommentB c where date=?)
pm.execute(select c.text from CommentC c where date=?)

so your write may be fast but now your reads will be slow.

u cant 'OR' the queries since they are different entities.

This solution doesnt look like a scalable solution for bigtable.
was the article for SQL tables NOT bigtable?

-lp

-- 
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] appcfg deployment hangs at jsp compile

2011-03-04 Thread lp
hi guys

i cannot deploy to appengine because the appcfg hangs at 8% jsp
compiling.

i have deployed hundreds of these and i dunno what is wrong.

i am losing my mind over this simple deployment.

appcfg.cmd update c:\src\mingle\geoserver\trunk\target\geoserver-1.0-
SNAPSHOT
Reading application configuration data...
4/03/2011 15:15:00
com.google.apphosting.utils.config.AppEngineWebXmlReader read
AppEngineWebXml
INFO: Successfully processed c:/src/mingle/geoserver/trunk/target/
geoserver-1.0-
SNAPSHOT\WEB-INF/appengine-web.xml
4/03/2011 15:15:00
com.google.apphosting.utils.config.AbstractConfigXmlReader re
adConfigXml
INFO: Successfully processed c:/src/mingle/geoserver/trunk/target/
geoserver-1.0-
SNAPSHOT\WEB-INF/web.xml
4/03/2011 15:15:00
com.google.apphosting.utils.config.AbstractConfigXmlReader re
adConfigXml
INFO: Successfully processed c:/src/mingle/geoserver/trunk/target/
geoserver-1.0-
SNAPSHOT\WEB-INF/cron.xml
4/03/2011 15:15:00 com.google.apphosting.utils.config.IndexesXmlReader
readConfi
gXml
INFO: Successfully processed c:\src\mingle\geoserver\trunk\target
\geoserver-1.0-
SNAPSHOT\WEB-INF\appengine-generated\datastore-indexes-auto.xml
Beginning server interaction for minglegeo...
0% Creating staging directory
5% Scanning for jsp files.
8% Compiling jsp files.

thats it.. it stay like that for ever.

after 1 minute 10 minutes doesnt matter. nothing changes.

no errors in console or logs.

a javac process is running with 0 cpu

i am using jdk1.6_06

any help is most appreciated for my sanity,

thanks

-lp

-- 
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 query - jdo

2011-03-04 Thread lp
 The persistence layer uses lazy-load approach, so when in jsp it tries to
 access to entities extracted from the database it throws exception because
 the persistence manager is just closed.
 So, how to avoid this problem?

so either use eager fetch... not a good idea for large objects.
OR
use a VTO pattern (http://java.sun.com/blueprints/patterns/
TransferObject.html) to populate ur presentation objects.
this enables the persistence layer transaction to be abstracted away
from presentation.

VTO pattern is more usefull.

-lp

-- 
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 data migration using JDO and DataNucleus

2011-03-03 Thread lp
are u sure u wont to proceed with that plan of changing out enhanced
JDO classes?
just sounds to complicated.

-lp



On Mar 3, 5:21 am, Jason G ja...@bobberinteractive.com wrote:
 Hello everyone!

 We've run into a data migration-test problem, and I'm wondering if
 anyone would have any advice on how to proceed...

 We're building a system that needs to allow hot-swapping of
 application builds while customers are actively using our webapp, and
 that means we need to support data object schema migration in-
 place.  We do this by implementing LoadCallback for version migration,
 and @Deprecated-ing no-longer-used fields.  So far, so good.

 Thing is, we'd like to build up a test suite that allows developers to
 write unit tests for data migration against a local environment. That
 means no uploading to GAE, but using
 com.google.appengine.tools.development.testing.LocalServiceTestHelper
 instead.

 We have two classes directories: Both containing DataNucleus-JDO-
 enhanced .class files, one of the old schema, and one of the
 current.

 We have a MigrationTestHelper that creates a GroovyClassLoader with
 the old schema set as its classpath.  The targetted class under test
 is found, instantiated, and passed to a test-supplied Closure that
 initializes the object with the old data to be migrated.  The Helper
 calls PersistenceManager.makePersistent and returns
 pm.getObjectId(newlyPersisted).getKey().

 The second half of the test involves creating a new GroovyClassLoader
 and setting the context class loader:
 Thread.currentThread().setContextClassLoader(loader).  Then we use a
 different PersistenceManager (from a different
 PersistenceManagerFactory) to load the object by its Key.

 What happens is we get a ClassCastException:
 java.lang.ClassCastException: java.lang.Long cannot be cast to
 java.util.List
         at com.x.model.User.jdoReplaceField(User.groovy)
         at com.x.model.User.jdoReplaceFields(User.groovy)
         at
 org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:
 2772)
         at
 org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:
 2791)
         at
 org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:
 480)

 It *appears* as though the JDOStateManagerImpl uses an array of fields
 to get/set values.  You can crack open the enhanced .class files and
 see there's a method called __jdoFieldNamesInit() that sets up a
 static list of Fields.

 The old User contains the field: balance, which is a Long.
 The new User contains the fields: balance, which is @Deprecated and
 is Long, and _balances, which is a List.

 Looking in the .class files, it looks like each field is ordered
 alphabetically, so in old User, balance is index 0, where in new
 User, balance is index 1 and _balances is index 0.  Hence the
 ClassCastException.

 I'm stuck on how to proceed.  I'd have thought that fields would be
 replaced based on field name, not on an index...  Especially an index
 that we don't appear to be able to control.  But if it's the case that
 fields are placed by index on load, how does data migration work on
 AppEngine itself?  Our migration code works fine there...

 Is this a DataNucleus issue?  An issue with LocalServiceTestHelper?
 An issue of developer sanity? ;)

 Any insight would be greatly appriciated!

 Thanks!
 Jason

-- 
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 write a JPA unit test for GAE?

2010-11-16 Thread lp
ok i finally got this sorted.

it seems that i was making life too difficult by making tests
transactional.

by removing the @transactional on unit tests everything works nice and
simple.

thanks for your help

-lp

On Nov 15, 4:51 pm, lp lucio.picc...@gmail.com wrote:
 hi vikas

 thanks for the spring config.

 i got the same config but still cant get aunittestto persist data,
 and then execute a query on it.

 i noticed that your config does not use

 bean
 class=org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
  /



 how does the entitymanager get injected?

 have u got the code available? i cant see what i am doing wrong!

 -lp

 On Nov 15, 3:02 pm, Vikas Hazrati vhazr...@gmail.com wrote:

  hi lucio,

  I have added the requested information as an answer to your comment on
  the blog post.

 http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-a...

  regards | Vikaswww.inphina.com

  On Nov 15, 4:23 am, lp lucio.picc...@gmail.com wrote:

   hi vikas

   nice blog u have there. However i cant reproduce your results theunit
  testwith spring.
   can u post your spring config to see what i have done wrong.

   thanks

   -lp

   On Nov 13, 3:58 pm, Vikas Hazrati vhazr...@gmail.com wrote:

You could get more information on the way we set up our testing infra
here

   http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-a...

Regards | Vikaswww.inphina.com

-- 
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 write a JPA unit test for GAE?

2010-11-14 Thread lp
hi vikas

nice blog u have there. However i cant reproduce your results the unit
test with spring.
can u post your spring config to see what i have done wrong.

thanks

-lp

On Nov 13, 3:58 pm, Vikas Hazrati vhazr...@gmail.com wrote:
 You could get more information on the way we set up our testing infra
 here

 http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-a...

 Regards | Vikaswww.inphina.com

-- 
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 write a JPA unit test for GAE?

2010-11-14 Thread lp
hi vikas

thanks for the spring config.

i got the same config but still cant get a unit test to persist data,
and then execute a query on it.

i noticed that your config does not use

bean
class=org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor
 /


how does the entitymanager get injected?

have u got the code available? i cant see what i am doing wrong!

-lp

On Nov 15, 3:02 pm, Vikas Hazrati vhazr...@gmail.com wrote:
 hi lucio,

 I have added the requested information as an answer to your comment on
 the blog post.

 http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-a...

 regards | Vikaswww.inphina.com

 On Nov 15, 4:23 am, lp lucio.picc...@gmail.com wrote:

  hi vikas

  nice blog u have there. However i cant reproduce your results theunit
 testwith spring.
  can u post your spring config to see what i have done wrong.

  thanks

  -lp

  On Nov 13, 3:58 pm, Vikas Hazrati vhazr...@gmail.com wrote:

   You could get more information on the way we set up our testing infra
   here

  http://thoughts.inphina.com/2010/06/28/unit-testing-maven-based-jpa-a...

   Regards | Vikaswww.inphina.com

-- 
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 write a JPA unit test for GAE?

2010-11-10 Thread lp
hi all,

i have been attempting to convert my existing JPA code over to GAE.

All is working so far except for the unit tests.

i read
code.google.com/appengine/docs/java/tools/localunittesting.html

but it doesnt describe how to get an entityManager involved in usefull
unit tests.

so this is my test. please advise how to achieve the functionality in
this test.

@Test
public void findFriendsSimple() {



PositionUser user1 = new PositionUser();
user1.setFirstName(john);
user1.setLastName(smith);

PositionUser user2 = new PositionUser();
user2.setFirstName(mary);
user2.setLastName(smith);

PositionUser user3 = new PositionUser();
user3.setFirstName(barney);
user3.setLastName(smith);

em.persist(user2);
em.persist(user3);
//em.flush(); --- can use flush for non transaction test

user1.getFriends().add(user2.getKey());
user1.getFriends().add(user3.getKey());

em.persist(user1);
//em.flush(); --- can use flush for non transaction test

Query query = em.createNamedQuery(PositionUser.FIND_FRIENDS);
query.setParameter(userKey, user1.getKey());
List resultList = query.getResultList();
assertEquals( 2, resultList.size() );

}

the assert is triggered
java.lang.AssertionError: expected:2 but was:0

this is because the entitymanager wont detect the persisted entities
that arent in a transaction.

ok no problem, i will add transactions.

But when i do it complains that i am adding multiple groups in a single
transaction.

So besides the simple gae sample unit test, how are others writting
useful unit tests in gae?

any help is most appreciated

-lp

-- 
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 write a JPA unit test for GAE?

2010-11-10 Thread lp
thanks for the detailed response didier.

the layout of the entities is fine, as transactions are not used in
the application itself, but as a artefact for unit testing.
i only placed the unit tests into a transaction for the purposes of
flushing the to entityManager.

since txn dont work for multiple entities how can i structure my unit
tests to ensure that the entity manager can perform a query on
populated data?

ie.

@Test
public void mytest(){

//populate ds with data... some how ??

Query query = em.createNamedQuery(PositionUser.FIND_FRIENDS)
List resultList = query.getResultList();
assertEquals( 2, resultList.size() );

}


thanks

-lp
On Nov 10, 8:44 pm, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 Entities that you persist in the datastore are grouped in so called
 entity groups for reason of scalability and transactionality

 That means that the ds groups your entities on various data servers
 according to their keys: this mechanism is not transparent - it
 generates the exception that you encounter when you touch entities
 belonging to more than 1 group in a single transaction.

 This mechanism is specific to GAE: it means that it is not transparent
 when you migrate the source code an already existing JPA app. You may
 have to rethink your data architecture and modify code accordingly.

 You should read the dev docs and articles:

 1)http://code.google.com/appengine/docs/python/datastore/keysandentityg...

 2)http://code.google.com/appengine/docs/java/datastore/transactions.html

 3)http://blog.dantup.com/2010/01/app-engine-entity-groups-contention-an...

 4)http://hoangle.info/2010/08/01/datastore-in-google-app-engine-entity-...

 hope it helps

 On Nov 10, 10:37 am, lp lucio.picc...@gmail.com wrote:

  hi all,

  i have been attempting to convert my existing JPA code over to GAE.

  All is working so far except for the unit tests.

  i read
  code.google.com/appengine/docs/java/tools/localunittesting.html

  but it doesnt describe how to get an entityManager involved in usefull
  unit tests.

  so this is my test. please advise how to achieve the functionality in
  this test.

  @Test
  public void findFriendsSimple() {

  PositionUser user1 = new PositionUser();
  user1.setFirstName(john);
  user1.setLastName(smith);

  PositionUser user2 = new PositionUser();
  user2.setFirstName(mary);
  user2.setLastName(smith);

  PositionUser user3 = new PositionUser();
  user3.setFirstName(barney);
  user3.setLastName(smith);

  em.persist(user2);
  em.persist(user3);
  //em.flush(); --- can use flush for non transaction test

  user1.getFriends().add(user2.getKey());
  user1.getFriends().add(user3.getKey());

  em.persist(user1);
  //em.flush(); --- can use flush for non transaction test

  Query query = em.createNamedQuery(PositionUser.FIND_FRIENDS);
  query.setParameter(userKey, user1.getKey());
  List resultList = query.getResultList();
  assertEquals( 2, resultList.size() );

  }

  the assert is triggered
  java.lang.AssertionError: expected:2 but was:0

  this is because the entitymanager wont detect the persisted entities
  that arent in a transaction.

  ok no problem, i will add transactions.

  But when i do it complains that i am adding multiple groups in a single
  transaction.

  So besides the simple gae sample unit test, how are others writting
  useful unit tests in gae?

  any help is most appreciated

  -lp

-- 
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 write a JPA unit test for GAE?

2010-11-10 Thread lp

 Instead of flushing, did you try a PersistenceManager.close() that
 should lead to the same effect ? After the close, you get a new pm via
 the PMF and that should do it.

i dunno if i can do that so easily as the entityManager is injected by
spring.

i have a very very very simple example that doesnt not work under gae/
spring.

what do i need to get this to work under gae?

this test case *works* fine under hibernate but fails with gae with a
assert after the query.

any ideas?

@SuppressWarnings(unchecked)
@Test
public void findUserSimple() {
PositionUser user1 = new PositionUser();
user1.setFirstName(john);
user1.setLastName(smith);
user1.setFacebook(11);
em.persist(user1);
em.refresh(user1);
System.out.println( key: + user1.getKey());
PositionUser find = em.find(PositionUser.class, user1.getKey());
assertNotNull(find);

Query query = em.createQuery(Select p from PositionUser p where
p.firstName=:firstname);
query.setParameter(firstname, user1.getFirstName());
List resultList = query.getResultList();
assertEquals( 1, resultList.size() ); --- assert fails here

}

-- 
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] package 'datastore_v3' or call 'Rollback()' was not found

2010-11-09 Thread lp
hi all,

when running a unit test using  i am getting the error below.

i have followed the data store unit test guide lines.
http://code.google.com/appengine/docs/java/tools/localunittesting.html#Writing_Datastore_Tests

is it as simple as a missing jar, but which one?

WARNING: Caught exception while allowing TestExecutionListener
[org.springframework.test.context.transaction.transactionaltestexecutionliste...@18346a3]
to process 'after' execution for test: method [public void
com.asteriski.mingle.geo.entity.PositionUserEntityTest.insertWithGoogleDataSource()],
instance
[com.asteriski.mingle.geo.entity.positionuserentityt...@19299f5],
exception [java.lang.NullPointerException]
com.google.apphosting.api.ApiProxy$CallNotFoundException: The API
package 'datastore_v3' or call 'Rollback()' was not found.
at
com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:95)
at
com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:
58)
at
com.google.appengine.api.datastore.TransactionImpl.makeSyncCall(TransactionImpl.java:
42)
at
com.google.appengine.api.datastore.TransactionImpl.makeSyncCall(TransactionImpl.java:
56)
at
com.google.appengine.api.datastore.TransactionImpl.rollback(TransactionImpl.java:
77)

i assume that i am missing a appengine jar file in the maven
dependencies. is that correct?

any help is appreciated.

-lp

-- 
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: package 'datastore_v3' or call 'Rollback()' was not found

2010-11-09 Thread lp
ok i was missing a maven dependency for appengine-api-1.0-
sdk-1.3.8.jar.

the gae-plugin was hiding the visibility of it to the test phase.

so i can now run a junit  test with transaction using persistence.

-lp


On Nov 10, 2:17 pm, lp lucio.picc...@gmail.com wrote:
 hi all,

 when running a unit test using  i am getting the error below.

 i have followed the data store unit test guide 
 lines.http://code.google.com/appengine/docs/java/tools/localunittesting.htm...

 is it as simple as a missing jar, but which one?

 WARNING: Caught exception while allowing TestExecutionListener
 [org.springframework.test.context.transaction.transactionaltestexecutionliste...@18346a3]
 to process 'after' execution for test: method [public void
 com.asteriski.mingle.geo.entity.PositionUserEntityTest.insertWithGoogleDataSource()],
 instance
 [com.asteriski.mingle.geo.entity.positionuserentityt...@19299f5],
 exception [java.lang.NullPointerException]
 com.google.apphosting.api.ApiProxy$CallNotFoundException: The API
 package 'datastore_v3' or call 'Rollback()' was not found.
         at
 com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:95)
         at
 com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:
 58)
         at
 com.google.appengine.api.datastore.TransactionImpl.makeSyncCall(TransactionImpl.java:
 42)
         at
 com.google.appengine.api.datastore.TransactionImpl.makeSyncCall(TransactionImpl.java:
 56)
         at
 com.google.appengine.api.datastore.TransactionImpl.rollback(TransactionImpl.java:
 77)

 i assume that i am missing a appengine jar file in the maven
 dependencies. is that correct?

 any help is appreciated.

 -lp

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



Re: [appengine-java] Re: Trouble unit testing JPA data access objects.

2010-11-04 Thread lp
how did u get your unit tests to run in tx?

i cant seem to get an active transaction.

i followed all the links in this thread and more.

any help appreciated

-lp

-- 
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] JPA transaction not active in Spring unit test

2010-11-03 Thread lp
hi all,

i am attempting to unit test my JPA code in a Spring unit test.

i read all the doco about gae unit tests.

i have this working in normal hibernate JPA with a specific tx
manager.

I cant see how the txManager is wired up.

however i get the following error

javax.persistence.TransactionRequiredException: This operation
requires a transaction yet it is not active
at
org.datanucleus.jpa.EntityManagerImpl.assertIsActive(EntityManagerImpl.java:
846)
at org.datanucleus.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:
545)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator
$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:
365)
at $Proxy29.flush(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)


the test is simple enuff

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { classpath:WEB-INF/entitymanager-
context.xml, classpath:WEB-INF/applicationContext.xml  })
@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class })
@TransactionConfiguration( defaultRollback=false,
transactionManager=transactionManager)
@Transactional
public abstract class MyTestCase  {

 private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());

@PersistenceContext
protected
EntityManager em;

@Test
public void findFriendsSimple() {



PositionUser user1 = new PositionUser();
user1.setFirstName(john);
user1.setLastName(smith);
user1.setGeohash(Geohash.encode(lat+=0.0001, lon));

em.persist(user1);
em.flush(); - throws here

 PositionUser find = em.find(PositionUser.class,
user1.getKey());
 assertEquals( john, find.getFirstName());
 assertEquals( 2, find.getFriends().size() );

 System.out.println(--running query now);
 Query query = em.createNamedQuery(PositionUser.FIND_FRIENDS);
 query.setParameter(userKey, user1.getKey());
 List resultList = query.getResultList();
 assertEquals( 2, resultList.size() );


}

-- 
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: datanucleus enhancer keeps running

2010-03-11 Thread lp
i tried using gae sdk 1.3.1 but still got enhancer looping.

it seems to happen when i include spring 3.x libs i dunno giving
up and going for ant task.

-lp

On Mar 3, 1:43 am, Rajeev Dayal rda...@google.com wrote:
 Seehttp://code.google.com/p/googleappengine/issues/detail?id=2115. This may
 be the issue that you're having. It was recently fixed, and a version of GPE
 with the fix is forthcoming.

 On Thu, Feb 25, 2010 at 1:57 PM, Steve Pritchard steve...@gmail.com wrote:

  On Feb 25, 6:39 am, haole mejoe...@gmail.com wrote:
   i'm using eclipse 3.5.1, GPE 3.5 (1.2.0.v200912062003), GAE
   1.3.1.v201002101412, GWT 2.0.3.v201002191036
   datanucleusenhancer continuously runs over and over again
   temporary workaround: turn off build automatically feature in eclipse

  I have several projects with a dependency hierarchy.  I found the
  enhancer to be fragile and it often would not enhance the classes.   I
  had to do a 'clean' to make it happen. I could not find the pattern to
  when it failed to enhance.  It never looped on me so you may be seeing
  a different problem.

  About 3 weeks ago I had had enough and  turned off the Enhancer
  builder (the plugin yelled at me).  In its place I added an ant task
  to do the enhancement.  I derived the ant task statements from the
  Datanucleus site.  Since that time things have been very stable and
  the enhancer always finishes its job.

  This is the essence of the ant task:

   !--
   --
   !--                          T A S K D E F
  S                         --
   !--
   --

   taskdef name=enhance
  classname=com.google.appengine.tools.enhancer.EnhancerTask
       classpath
         pathelement path=${appengine.tools.classpath}/
         pathelement path=${appengine.tools.lib}/
       /classpath
   /taskdef

   !--
   --
   !--                          T A R G E T
  S                           --
   !--
   --

   target name=enhance.cls
       description=Performs Datnucleus JDO enhancement on compiled
  data classes.
     !-- echo message= path ${appengine.tools.classpath}/ --
     !-- echo message= fileset ${proj.dir.gen.cls}/ --
     enhance failonerror=true verbose=false
       classpath
         pathelement path=${appengine.tools.classpath}/
         fileset dir=${proj.dir.war.lib} includes=*.jar/
         pathelement path=${proj.dir.gen.cls}/
       /classpath
       fileset dir=${proj.dir.gen.cls} includes=**/*.class/
     /enhance
   /target

   target name=enhance.war
       description=Performs Datnucleus JDO enhancement on war
  classes.
     !-- echo message= path ${appengine.tools.classpath}/ --
     !-- echo message= fileset ${proj.dir.gen.cls}/ --
     enhance failonerror=true verbose=false
       classpath
         pathelement path=${appengine.tools.classpath}/
         fileset dir=${proj.dir.war.lib} includes=*.jar/
         pathelement path=${proj.dir.war.cls}/
       /classpath
       fileset dir=${proj.dir.war.cls} includes=**/*.class/
     /enhance
   /target

  It may be worth a try.
  Steve

  --
  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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://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] Application code attempted to create a EntityManagerFactory named transactions-optional,

2010-01-05 Thread lp
hi there

i am attempting a very simple task of running a junit + spring
+...@persistencecontext but getting the following error

Caused by: java.lang.IllegalStateException: Application code attempted
to create a EntityManagerFactory named transactions-optional, but one
with this name already exists!  Instances of EntityManagerFactory are
extremely slow to create and it is usually not necessary to create one
with a given name more than once.  Instead, create a singleton and
share it throughout your code.  If you really do need to create a
duplicate EntityManagerFactory (such as for a unittest suite), set the
appengine.orm.disable.duplicate.emf.exception system property to avoid
this error.
at
org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.checkForRepeatedAllocation
(DatastoreEntityM


the junit class is simple

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { classpath:entitymanager-
context.xml })

public class PositionUserBusinessTest extends LocalStorageTestCase {

@PersistenceContext
EntityManager em;

@Autowired
PositionUserBusiness business;

 @test
 void something test()


entitymanager-context.xml

!-- entity manager --
bean id=entityManagerFactory

class=org.springframework.orm.jpa.LocalEntityManagerFactoryBean
lazy-init=true
property name=persistenceUnitName 
value=transactions-optional /

/bean

bean name=transactionManager
class=org.springframework.orm.jpa.JpaTransactionManager
property name=entityManagerFactory 
ref=entityManagerFactory /
/bean

bean id=positionUserBusiness
 
class=com.asteriski.mingle.geo.business.PositionUserBusiness/




i dont understand why it is complaining about the mulitple instances
of persistence unit called ' transactions-optional' as it is only
being referenced by the spring binding.

what is the problem?

any help most appreciated.

-lp
-- 
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: convert JDO query to JPA

2009-11-23 Thread lp

         EntityManager em = EMF.get().createEntityManager();
         PrintWriter out = response.getWriter();

         ListDog dogs;

         try {

             Query query = em.createQuery(SELECT FROM Dog WHERE
 dogFriends = :key);
             query.setParameter(key, key);
             dogs = (ListDog) query.getResultList();

             dogs.size();  // Do this so we can eager load the list and

solve it!

running your code in my unit test i still get a 0 size result list.

*until* i added the following in my unittest

Dog user1 = new Dog()

//blah blah
em.merge(user1);

em.close();  -- needed to close existing em

em = getEnityManager();

//query now executes correctly


it seems that the entity manager is not working as i expected.
by doing em.close after making objects persistent and then getting new
em, allowed the em.query to execute correctly.

i am not clear of why the em behaviours like that, given the em.find()
seem to find the correct object.

any ideas?

-lp

--

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: convert JDO query to JPA

2009-11-23 Thread lp

 EntityManager em = EMF.get().createEntityManager();
 PrintWriter out = response.getWriter();

 ListDog dogs;

 try {

 Query query = em.createQuery(SELECT FROM Dog WHERE
 dogFriends = :key);
 query.setParameter(key, key);
 dogs = (ListDog) query.getResultList();

 dogs.size();  // Do this so we can eager load the list and

solve it!

running your code in my unit test i still get a 0 size result list.

*until* i added the following in my unittest

Dog user1 = new Dog()

//blah blah
em.merge(user1);

em.close();  -- needed to close existing em

em = getEnityManager();

//query now executes correctly


it seems that the entity manager is not working as i expected.
by doing em.close after making objects persistent and then getting new
em, allowed the em.query to execute correctly.

i am not clear of why the em behaviours like that, given the em.find()
seem to find the correct object.

any ideas?

-lp

--

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: convert JDO query to JPA

2009-11-22 Thread lp
 Can you post the JPA version of your entity?

@Entity
public class Friend {


  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Key key;

  private String lastName;

  public int crud;

  private String firstName;

  @Basic
  private CollectionKey friends;


 I've just built something similar, and if I pass a Key to:

             query.setParameter(key, key);

 This works correctly, though if I pass the String key to it

             query.setParameter(key, someLongString);


what was ur query? was the query to filter on a collection?
i have set the parameters against primitive members successfully but
not against collection members.

 It returns an empty list. Could this be what is happening?

no.i just retested my code to make sure i hadnt messed up. i am
definitely using a Key not a string.

//JPA
javax.persistence.Query query = em.createQuery(select from Friend f
where f.friends=:key);
query.setParameter(key, user2.getKey());

return list of 0

using the *same* JPA entity code the JDO works fine

//JDO
javax.jdo.Query query = pm.newQuery(Friend.class);
Key myKey = user2.getKey();
query.declareParameters(com.google.appengine.api.datastore.Key
myKey);
query.setFilter(friends == myKey);
query.setOrdering(lastName ASC, firstName ASC);
ListFriend friendList = (ListFriend) query.execute(myKey);

return correct list

Q1 can u post your JPA code so i can see what u have done differently?

Q2. is mixing JPA and JDO ok? ie. JPA entity and JDO seems to work for
me.

Q3.how does the collection equality filter work in app engine? I have
not found any docs to explain the 'voodoo' like behaviour.
from what i can determine the collection filter is executed on the
data store and not in the application as the unfiltered list executed
the 1000 row limit.
it works but i dont understand how.

any help most appreciated

-lp

--

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




[google-appengine] How to update my new version of db on server

2008-11-19 Thread lp

Hello

I need advice. I have application version 1, in her database they is
one model:
id1 date_1  date_2  int_1   nameemail   pass
In version 1 I have 6000 input

In version 2 I separated model in two parts
id1 date_1 name email pass
id2 id1 int_1 date_2

I want put my version 2 in production on server to replace version 1

Was is the best (and safe) method?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---