this is one to many

@PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class Province {
         @PrimaryKey
         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Long id;

         @Persistent
         private String name;

         @Persistent(mappedBy = "province")
         private List<Town> towns;

 **** Town.java ****
@PersistenceCapable(identityType = IdentityType.APPLICATION)
 public class Town {

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

         @Persistent
         private Province province;
}

On Aug 6, 5:45 am, Premier <[email protected]> wrote:
> Hello,
> i'm tring Java on GAE and usingJDOto map my beans. I attended 
> athttp://code.google.com/appengine/docs/java/datastore/relationships.ht...
> to set beans relationships, but, always occurs follow error
>
> Error in meta-data for com.bean.Town.id: Cannot have a java.lang.Long
> primary key and be a child object (owning field is
> com.bean.Province.town).
>
> My beans are
>
> **** Province.java ****
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Province {
>
>         @PrimaryKey
>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>         private Long id;
>
>         @Persistent
>         private String name;
>
>         @Persistent(mappedBy = "province")
>         private Town town;
>
> **** Town.java ****
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Town {
>
>         @PrimaryKey
>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>         private Long id;
>
>         @Persistent
>         private Province province;
>
> Example in link uses class like mine.
>
> How i can solve?
> how i can map relationships?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to