[appengine-java] Re: JDO: Null parent on some children objects

2010-08-26 Thread Diego Fernandes
Hi,
i may find something here 
http://code.google.com/intl/en/appengine/docs/java/datastore/relationships.html


[]'s
Diego


On 26 ago, 04:42, cghersi cristiano.ghe...@gmail.com wrote:
 Hi everybody,

 I'm struggling with a strange problem with JDO.
 I've got two PersistenCapable classes, one having a Collection of
 objects of the second, something like this:

 class First {
 �...@persistent
 �...@primarykey
  Long id;

 �...@persistent(mappedby=owner)
  ArrayListSecond list = new ArrayListSecond();

  ArrayListSecond getList() {
   if (list == null)
    list=new ArrayListSecond();
   return list;
  }

 ...

 }

 class Second {
 �...@persistent
 �...@primarykey
  Key id;

 �...@persistent
  First owner;

  First getOwner() {
   if (owner==null)
    owner = new First();
   return owner;

  ...

 }

 In another class I need to print the owner of all my First objects, so
 I do:
 First obj = ...;
 ArrayListSecond list = obj.getList();
 for (Second s : list) {
  System.out.println(s.getOwner());

 }

 In this loop, I find some Second object having null owner, and I
 cannot understand why.
 Now I have several questions about my data modelling:
 1) Do I need to mark any field with (defaultFetchGroup = true)
 annotation?
 2) Does the check on null object (e.g. if (owner==null) owner = new
 First();) in the getter methods results in any strange behavior?
 3) Does the assignment on definition of objects (e.g.
 ArrayListSecond list = new ArrayListSecond();) results in any
 strange behavior?
 4) Do I need to add any other annotation to owner field of Second
 class?

 Thank you very much for your help!!
 Best regards
 cghersi

-- 
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: HTTPS on App Engine

2010-08-26 Thread Diego Fernandes
Hi,

You may find something here 
http://code.google.com/intl/en/appengine/docs/java/config/webxml.html#Secure_URLs

On 26 ago, 05:41, Shawn Brown big.coffee.lo...@gmail.com wrote:
  I tried it but a call via http is still possible and wil not be
  automatically redirected to the https protocol.

 Are you using *.appspot.com?  It doesn't work for a custom domain, does it?

 Also Eclipse doesn't
  like the url-pattern in web-resource-collection and marks it as
  error.

 adding  web-resource-nameasdf/web-resource-name  resolved that for me

  security-constraint
   web-resource-collection

  web-resource-nameasdf/web-resource-name







   url-pattern/load/url-pattern
   /web-resource-collection
   user-data-constraint
   transport-guaranteeCONFIDENTIAL/transport-guarantee
   /user-data-constraint
  /security-constraint

-- 
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: Datastore - Duplication in saving unowned one-to-one relationship

2010-08-26 Thread Diego Fernandes
Hi,
when object is saved using the pm.makePersistent() method, the new
related child object is saved automatically. Since both objects are
new, App Engine creates two new entities in the same entity group.

[]'s
Diego

On 25 ago, 20:01, Rodrigo Sol rodrigo...@gmail.com wrote:
 Hi,

 Probably this is a newbie question, but I spent a whole day searching
 for a solution without success.

 I want to create an one-to-one relationships between two entities
 (City and Costumer). I have a form where I create new costumers. When
 I save this new costumer into the datastore a new register for city
 is created causing one unnecessary duplication.

 I am using unowned relationship and my model is above:

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 Class City{

     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     @Extension(vendorName=datanucleus, key=gae.encoded-pk, value=true)
     private String key;

     @Persistent
     private String nome;
     ...

 }

 @PersistenceCapable(identityType = IdentityType.APPLICATION)
 Class Costumer{

     @PrimaryKey
     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
     @Extension(vendorName=datanucleus, key=gae.encoded-pk, value=true)
     private String key;

     @Persistent
     private String cityKey;
     ...

 }

 And I am saving the Costumer class in this function:

     public void create(Costumer costumer) {
         PersistenceManager pm = Conn.get();
         try {
                 pm.makePersistent(costumer);
         } finally {
             pm.close();
         }
         return errors;

     }

 So, what I am doing wrong? It seems that in owned relationships this
 behavior (duplicate child object) is expected, but I can not
 understand why it is happening here.

 I would be grateful if anyone could help?

 Thanks in advance.

 Rodrigo Sol

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