Re: [appengine-java] Problem with persistence

2010-10-30 Thread A. Stevko
I can understand why this might seem to work.

The problem I see is that unTomeo was detached from the database and either
needs to be reattached or refetched before adding unEquipo to it.

Here is some documentation that may help explain.
http://www.jpox.org/docs/1_1/attach_detach.html

try this

  tx.begin();

   pm.makePersistent(unTorneo);

   unTorneo.agregarEquipo(unEquipo);

   tx.commit();


On Fri, Oct 29, 2010 at 6:22 PM, lisandrodc lisandr...@gmail.com wrote:

 Hi ! I have a problem with persist a class. The problem is that
 sometimes, persist and sometimes not persist the class Equipo . I
 have a persist class Torneo that has to many class Equipo, and
 when persist Equipo sometimes persist in the datastore and sometimes
 not persist.
 I have to try restarting the application in order that sometimes it
 work. Someone will be able to help me?
 The code to persist:

public void agregarEquipoConTorneo(Torneo unTorneo, Equipo unEquipo)
 {
/*add Equipo with a existing Torneo in the datastore, the
 unTorneo(param) class obtain with: Torneo b =
 pm.getObjectById(model.Torneo.class, idTorneo);*/
Transaction tx = pm.currentTransaction();

try {
tx.begin();

unTorneo.agregarEquipo(unEquipo);
//pm.makePersistent(unEquipo);

pm.makePersistentAll(unTorneo);

tx.commit();

System.out.println(persistioTorneoConEquipo);
} finally {
 pm.close();
if (tx.isActive()) {
tx.rollback();
}
}

 }

 Regards

 --
 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] Re: Simple cron job causes This request caused a new process to be started for your application

2010-10-30 Thread Didier Durand
Hi,

You're not doing anything wrong: just that after long inactivity, your
app gets unloaded from app engine, when it restarts (here because of
cron), it needs to reload classes and al.  Hence the message.

This happens fairly often when the application doesn't have much
trafic.

regards
didier

On Oct 30, 7:10 am, Richard Berger richardlan...@gmail.com wrote:
 Just testing to see if I can get a basic cron job working. Set up the
 cron.xml, create a servlet, modify web.xml, deploy. And every two
 minutes it runs and correctly prints the message I am logging:

 W10-29 09:44PM 30.390
 com.rb.commit1.DailyNotificationServlet doGet: This is our cron test

 But (a) CPU usage is high (1400ms) and that is because my app code is
 being loaded over and over as shown by the message that I also get
 every two minutes:
 I10-29 09:44PM 30.413
 This request caused a new process to be started for your application,
 and thus caused your application code to be loaded for the first time.
 This request may thus take longer and use more CPU than a typical
 request for your application.

 My servlet code seems as simple as possible:

 public class DailyNotificationServlet extends HttpServlet {

 private static Logger logger =
 Logger.getLogger(DailyNotificationServlet.class.getName());

 public void doGet(HttpServletRequest req, HttpServletResponse resp)
 throws IOException {

 logger.warning(This is our cron test);

 }
 }

 Any idea of what I might be doing wrong?

 Thanks so much,

 RB

-- 
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: Change namespace on existing entities

2010-10-30 Thread Didier Durand
Hi,

Question from side: do Payment  Invoice belong to the same entity
group as Party ? I ask this because of the transactional implications
it will have when you modify keys in Payments  Invoices.

regards
didier

On Oct 30, 5:04 am, aswath satrasala aswath.satras...@gmail.com
wrote:
 Hi,
 Further, on this... which leads to how changing of the namespace can be done
 using mapreduce.

 If I recreate entities, then if the keys are stored as references in other
 entities also needs to be recreated.
 Ex.
 class Party {
   @Long id
   KeyTenant tenantKey;  // partitioning/filtering
   String fname

 }

 I have several other entitities dependent on the Party Key.
 class Invoice {
 �...@long id
  Keyparty partyKey
  ...}

 class Payment {
 �...@long id
  KeyParty partyKey

 }

 All invoices/Payments has to be re-created.

 So, how can this be done using mapreduce jobs.  One option is
 - Using mapreduce, all the Party entities are recreated.  The originalkey
 and the newkey is stored in a different mapping table, something like this
 and operates in the empty namespace.
 class MigrationMappingKeys {
 @Long id;
 KeyParty oldKey
 KeyParty newKey

 }

 Then, I run the mapreduce job on the Invoice and Payment, and recreate based
 on the above class.

 Any other options...?
 -Aswath

 On Thu, Oct 28, 2010 at 3:25 PM, Didier Durand durand.did...@gmail.comwrote:

  Hi,

 http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
  says

  When a namespace aware class (e.g., Key, Query and MemcacheService)
  is constructed, it determines which namespace will be used by calling
  get() if it is otherwise unspecified. If get() returns null, the
  current namespace is unset and these APIs will use the empty ()
  namespace in its place. 

  So, I would guess that you have to recreate / copy your entities after
  having set namespace via NameSpaceManager.set() if you want to move
  them into a new namespace

  regards
  didier

  On Oct 28, 11:34 am, aswath satrasala aswath.satras...@gmail.com
  wrote:
   Hello,
   I have an multi-tenant app-id, and I have designed on partitioning the
   entities based on  url parameters.  I am not using the namespace yet.

   For example,

   Tenant {
   @Id name+email;

   }

   class Party {
     @Long id
     KeyTenant tenantKey;  // partitioning/filtering
     String fname

   }

   Now, I am planning to use the NamespaceManager for the Party entities.  I
   want to use the mapreduce and apply the namespace on the existing Party
   entities.
   Can a namespace be changed from empty to certain value on the existing
   entity.

   -Aswathhttp://vs-accounting.appspot.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.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.



Re: [appengine-java] Re: Change namespace on existing entities

2010-10-30 Thread aswath satrasala
Good point.  They belong to the same entity group.  The more complete
Objectify class is shown.
public class Payment implements IsSerializable {
@Id
private Long id;
@Parent KeyParty parentPartyKey;
private String comments;
private double amount;
}

public class Invoice IsSerializable {
@Id Long id;
@Parent KeyParty parentPartyKey;
InvoiceType invoiceType;
Status status;
private double amount;
}

In the application,there are situations, where I update the Payment and
Invoice in a transaction.

So, how can this be done in mapreduce.

-Aswath

On Sat, Oct 30, 2010 at 12:26 PM, Didier Durand durand.did...@gmail.comwrote:

 Hi,

 Question from side: do Payment  Invoice belong to the same entity
 group as Party ? I ask this because of the transactional implications
 it will have when you modify keys in Payments  Invoices.

 regards
 didier

 On Oct 30, 5:04 am, aswath satrasala aswath.satras...@gmail.com
 wrote:
  Hi,
  Further, on this... which leads to how changing of the namespace can be
 done
  using mapreduce.
 
  If I recreate entities, then if the keys are stored as references in
 other
  entities also needs to be recreated.
  Ex.
  class Party {
@Long id
KeyTenant tenantKey;  // partitioning/filtering
String fname
 
  }
 
  I have several other entitities dependent on the Party Key.
  class Invoice {
   @Long id
   Keyparty partyKey
   ...}
 
  class Payment {
   @Long id
   KeyParty partyKey
 
  }
 
  All invoices/Payments has to be re-created.
 
  So, how can this be done using mapreduce jobs.  One option is
  - Using mapreduce, all the Party entities are recreated.  The originalkey
  and the newkey is stored in a different mapping table, something like
 this
  and operates in the empty namespace.
  class MigrationMappingKeys {
  @Long id;
  KeyParty oldKey
  KeyParty newKey
 
  }
 
  Then, I run the mapreduce job on the Invoice and Payment, and recreate
 based
  on the above class.
 
  Any other options...?
  -Aswath
 
  On Thu, Oct 28, 2010 at 3:25 PM, Didier Durand durand.did...@gmail.com
 wrote:
 
   Hi,
 
  http://code.google.com/appengine/docs/java/javadoc/com/google/appengi.
 ..
   says
 
   When a namespace aware class (e.g., Key, Query and MemcacheService)
   is constructed, it determines which namespace will be used by calling
   get() if it is otherwise unspecified. If get() returns null, the
   current namespace is unset and these APIs will use the empty ()
   namespace in its place. 
 
   So, I would guess that you have to recreate / copy your entities after
   having set namespace via NameSpaceManager.set() if you want to move
   them into a new namespace
 
   regards
   didier
 
   On Oct 28, 11:34 am, aswath satrasala aswath.satras...@gmail.com
   wrote:
Hello,
I have an multi-tenant app-id, and I have designed on partitioning
 the
entities based on  url parameters.  I am not using the namespace yet.
 
For example,
 
Tenant {
@Id name+email;
 
}
 
class Party {
  @Long id
  KeyTenant tenantKey;  // partitioning/filtering
  String fname
 
}
 
Now, I am planning to use the NamespaceManager for the Party
 entities.  I
want to use the mapreduce and apply the namespace on the existing
 Party
entities.
Can a namespace be changed from empty to certain value on the
 existing
entity.
 
-Aswathhttp://vs-accounting.appspot.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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
 google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@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.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] Re: Newly deployed app doesn’t se em always reflected on the server.

2010-10-30 Thread andrew
As mentioned, IF you are changing version number you will need to set
latest as default. Check versions page in dashboard.

I have seen some slight delays after default is changed for switchover
to new version to occur. A minute maybe.

Also, on browser, while on your app page, hit Control F5 to force
refresh.

-- 
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: Change namespace on existing entities

2010-10-30 Thread Didier Durand
Hi,

Since they all belong to the same entity group, you have to recreate
also the other entities as well.

I would personally handle that per entity group, i.e launch a task
(for parallelism)  per entity group then recreate the parent of the
entity group in the new namespace, then recreate all the other
entities within this group in this new namespace.

regards

didier

On Oct 30, 9:46 am, aswath satrasala aswath.satras...@gmail.com
wrote:
 Good point.  They belong to the same entity group.  The more complete
 Objectify class is shown.
 public class Payment implements IsSerializable {
     @Id
     private Long id;
     @Parent KeyParty parentPartyKey;
     private String comments;
     private double amount;

 }

 public class Invoice IsSerializable {
     @Id Long id;
     @Parent KeyParty parentPartyKey;
     InvoiceType invoiceType;
     Status status;
     private double amount;

 }

 In the application,there are situations, where I update the Payment and
 Invoice in a transaction.

 So, how can this be done in mapreduce.

 -Aswath

 On Sat, Oct 30, 2010 at 12:26 PM, Didier Durand 
 durand.did...@gmail.comwrote:

  Hi,

  Question from side: do Payment  Invoice belong to the same entity
  group as Party ? I ask this because of the transactional implications
  it will have when you modify keys in Payments  Invoices.

  regards
  didier

  On Oct 30, 5:04 am, aswath satrasala aswath.satras...@gmail.com
  wrote:
   Hi,
   Further, on this... which leads to how changing of the namespace can be
  done
   using mapreduce.

   If I recreate entities, then if the keys are stored as references in
  other
   entities also needs to be recreated.
   Ex.
   class Party {
     @Long id
     KeyTenant tenantKey;  // partitioning/filtering
     String fname

   }

   I have several other entitities dependent on the Party Key.
   class Invoice {
   �...@long id
    Keyparty partyKey
    ...}

   class Payment {
   �...@long id
    KeyParty partyKey

   }

   All invoices/Payments has to be re-created.

   So, how can this be done using mapreduce jobs.  One option is
   - Using mapreduce, all the Party entities are recreated.  The originalkey
   and the newkey is stored in a different mapping table, something like
  this
   and operates in the empty namespace.
   class MigrationMappingKeys {
   @Long id;
   KeyParty oldKey
   KeyParty newKey

   }

   Then, I run the mapreduce job on the Invoice and Payment, and recreate
  based
   on the above class.

   Any other options...?
   -Aswath

   On Thu, Oct 28, 2010 at 3:25 PM, Didier Durand durand.did...@gmail.com
  wrote:

Hi,

   http://code.google.com/appengine/docs/java/javadoc/com/google/appengi.
  ..
says

When a namespace aware class (e.g., Key, Query and MemcacheService)
is constructed, it determines which namespace will be used by calling
get() if it is otherwise unspecified. If get() returns null, the
current namespace is unset and these APIs will use the empty ()
namespace in its place. 

So, I would guess that you have to recreate / copy your entities after
having set namespace via NameSpaceManager.set() if you want to move
them into a new namespace

regards
didier

On Oct 28, 11:34 am, aswath satrasala aswath.satras...@gmail.com
wrote:
 Hello,
 I have an multi-tenant app-id, and I have designed on partitioning
  the
 entities based on  url parameters.  I am not using the namespace yet.

 For example,

 Tenant {
 @Id name+email;

 }

 class Party {
   @Long id
   KeyTenant tenantKey;  // partitioning/filtering
   String fname

 }

 Now, I am planning to use the NamespaceManager for the Party
  entities.  I
 want to use the mapreduce and apply the namespace on the existing
  Party
 entities.
 Can a namespace be changed from empty to certain value on the
  existing
 entity.

 -Aswathhttp://vs-accounting.appspot.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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@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.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 

[appengine-java] Re: Newly deployed app doesn’t se em always reflected on the server.

2010-10-30 Thread dilbert
It is not about a change of version and it is not just about hitting
F5.

On Oct 30, 9:59 am, andrew aute...@gmail.com wrote:
 As mentioned, IF you are changing version number you will need to set
 latest as default. Check versions page in dashboard.

 I have seen some slight delays after default is changed for switchover
 to new version to occur. A minute maybe.

 Also, on browser, while on your app page, hit Control F5 to force
 refresh.

-- 
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] Security and Authentication - security-constraint in web.xml annoying error

2010-10-30 Thread Daniel
Hi i got the following setting in my web.xml:

security-constraint
web-resource-collection
url-pattern/*/url-pattern
/web-resource-collection
auth-constraint
role-name*/role-name
/auth-constraint
  /security-constraint

in eclipse it shows me a red X as if it was an error (the project
works fine and even can be deployed) but it asks me all the time if im
sure i want to deploy with the error)

HERE IS THE ERROR:

cvc-complex-type.2.4.a: Invalid content was found starting with
element 'url-pattern'. One of '{http://java.sun.com/xml/ns/
javaee:web-resource-name}' is expected.


And this is how the web.xml begins:

?xml version=1.0 encoding=utf-8?
web-app version=2.5 xmlns=http://java.sun.com/xml/ns/javaee;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xsi:schemaLocation=http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;


how can i fix this annoying error ?

Tx ahead

Daniel

-- 
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] Security and Authentication - security-constraint in web.xml annoying error

2010-10-30 Thread Shawn Brown
 how can i fix this annoying error ?

web-resource-name}' is expected.
see the top link in the following search and just add a web-resource-name

http://docs.sun.com/app/docs/doc/819-3669/bncbk?a=view

Shawn

-- 
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] Hierarchical Search

2010-10-30 Thread Ben Woodhead
Hello Everybody,


I am trying to build an efficient search like I saw in one of the
google IO videos. So the goal is to use the hierarchy of the datastore
to make the search more effecient. The datastore would look something
like this:


Database words

Database words.articlesmap
Database articles


Each article is broken down into a set of words and the article map
just holds the key to the article. The basic path


Find the article i want and get its key.
Use the key to search for all words.articlemap
Get the parent of each articleamp.


At this point I am completely lost. Heres what I have so far but I have
no idea if I am on the right path and second how do I actually do the
search


Word.java
[code]

@PersistenceCapable
public class Word {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;

@Persistent
String mWord;

@Persistent

ListArticleMap mArticleList;

public Word(String word)
{
mWord = word;
}


public Key GetKey() {
return mKey;
}


public void SetKey(Key key) {
mKey = key;
}

public String GetWord()
{
return mWord;
}


public void AddArticleMap( ArticleMap article )

{
if ( !mArticleList.contains(article) ) {
mArticleList.add(article);
}
}


public void RemoveArticleMap( ArticleMap article )
{
if ( !mArticleList.contains(article) ) {
mArticleList.remove(article);
}
}
}



[/code]


ArticleMap.java
[code]

@PersistenceCapable
public class ArticleMap {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;


@Persistent
private Key mArticleKey;

public Key GetKey() {
return mKey;
}


public void SetKey(Key key) {
mKey = key;
}

public Key GetArticleKey() {
return mArticleKey;
}


public void SetArticleKey(Key key) {
mArticleKey = key;
}
}
[/code]


Article.java
[code]

@PersistenceCapable
public class Article {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key mKey;

@Persistent
private Text mText;

public Article( Text text ) {
SetText(text);
}

public Key GetKey() {
return mKey;
}


public void SetKey(Key key) {
mKey = key;
}


public void SetText(Text text) {
mText = text;
}


public Text GetText() {
return mText;
}
}
[/code]


How do I tie the article map to the word itself, how do I tie the
article to the article map. How do I search for based on article map
and map that to article.


Thank you for your time
Ben

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