I have a class that looks like this:

package com.appspot.authagentpro;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.users.User;

@PersistenceCapable(detachable="true")
public class UserRelationship {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long key;

        @Persistent private String user;
        @Persistent private long host;
        @Persistent private boolean isAgent;
        @Persistent private boolean isAdmin;
}

But whenever I try to persist with the following code:
{
               Agency agency = new
Agency(request.getParameter("agency"), user.getEmail());
                ArrayList<Contact> c= new ArrayList<Contact>();
                c.add(contact);
                Agent agent = new Agent(request.getParameter("name"), c, agency,
request.getParameter("email"));


                PersistenceManager pm = PMF.get().getPersistenceManager();

                try{
                        pm.makePersistent(agent);
                        } finally{
                                pm.close();
                        }
                pm = PMF.get().getPersistenceManager();
                UserRelationship rel = new UserRelationship(user, 
agent.getKey(),
true, true);
                try{
                        pm.makePersistent(rel);
                        } finally{
                                pm.close();
                        }

I get this error message:
javax.jdo.JDOUserException: Attempt to handle persistence for object
using datastore-identity yet StoreManager for this datastore doesn't
support that identity type.

Please don't mind the clumsy code, I am just trying to make my way
through Java.

What I can see is that Entities Agent and Agency (in the 1st
makePersist statement) are getting persisted, but the one in second
transaction (UserRelationship) is not. I am using a new instance of PM
in botht the cases, and also I have tried using Key and Encoded String
as a primary key for UserRelationship.

Kindly Help

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

Reply via email to