am trying to persist Booth data and I am recieving
the following server error:
javax.servlet.ServletContext log: Exception while dispatching incoming
RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.util.ArrayList
xmltest.client.MapUserService.getUserBooth(xmltest.client.LoginInfo)'
threw an unexpected exception: javax.jdo.JDOFatalInternalException:
The key value passed to construct a SingleFieldIdentity of type "class
javax.jdo.identity.StringIdentity" for class "class
xmltest.server.MapUser" is null.
Booth.java
public class Booth implements Serializable
{
private String booth;
private String email;
private String company;
private String website;
private String address;
private String description;
private Double lat;
private Double lng;
private String image;
private String userComment;
private String city;
private String state;
private String country;
private int hall;
public Booth()
{
}
public Booth(String booth,Double lat, Double lng)
{
this.booth = booth;
this.lat = lat;
this.lng = lng;
}
public Booth(String company)
{
this.company = company;
}
public String getBooth()
{
return this.booth;
}
public String getWebsite()
{
return this.website;
}
public String getDescription()
{
return this.description;
}
public String getCompany()
{
return this.company;
}
public String getComment()
{
return this.userComment;
}
public double getLat()
{
return this.lat;
}
public double getLng()
{
return this.lng;
}
public int getHall()
{
return this.hall;
}
public String getEmail()
{
return this.email;
}
public String getAddress()
{
return this.address;
}
public String getCity()
{
return this.city;
}
public String getState()
{
return this.state;
}
public String getCountry()
{
return this.country;
}
public String getImage()
{
return this.image;
}
public void setImage(String image)
{
this.image = "http://pictures.attention-ngn.com//" +
image;
}
public void setCountry(String country)
{
this.country = country;
}
public void setState(String state)
{
this.state = state;
}
public void setCity(String city)
{
this.city = city;
}
public void setAddress(String address)
{
this.address = address;
}
public void setEmail(String email)
{
this.email = email;
}
public void setHall(int hall)
{
this.hall = hall;
}
public void setLng(double lng)
{
this.lng = lng;
}
public void setLat(double lat)
{
this.lat = lat;
}
public void setComment(String comment)
{
this.userComment = comment;
}
public void setCompany(String company)
{
this.company = company;
}
public void setDescription(String description)
{
this.description = description;
}
public void setWebsite(String website)
{
this.website = website;
}
public void setBooth(String booth)
{
this.booth = booth;
}
}
MapUser.java
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class MapUser
{
@PrimaryKey
private String userEmail;
@Persistent(serialized = "true")
private ArrayList<Booth> boothList = new ArrayList<Booth>();
public MapUser(String userEmail,Booth booths)
{
this.userEmail = userEmail;
this.boothList.add(booths);
}
public void setKey(String email)
{
this.userEmail = email;
}
public String getUserEmail()
{
return this.userEmail;
}
public ArrayList<Booth> getBooths()
{
return this.boothList;
}
public void addBooth(Booth booth)
{
this.boothList.add(booth);
}
}
MapUserServiceImpl.Java
@SuppressWarnings("serial")
public class MapUserServiceImpl extends RemoteServiceServlet
implements MapUserService
{
//private static final Logger LOG =
Logger.getLogger(MapUserServiceImpl.class.getName());
private static final PersistenceManagerFactory PMF =
JDOHelper.getPersistenceManagerFactory("transactions-
optional");
public void addComment(Booth booth,LoginInfo loginInfo)
{
PersistenceManager pm = getPersistenceManager();
try
{
MapUser mapuser =
pm.getObjectById(MapUser.class,loginInfo.getEmailAddress());
if(mapuser.getUserEmail() == null)
{
pm.makePersistent(new
MapUser(loginInfo.getEmailAddress(),booth));
}
else
{
mapuser.addBooth(booth);
}
}
finally
{
pm.close();
}
}
public ArrayList<Booth> getUserBooth(LoginInfo loginInfo)
{
PersistenceManager pm = getPersistenceManager();
try
{
MapUser mapUser =
pm.getObjectById(MapUser.class,loginInfo.getEmailAddress());
return mapUser.getBooths();
}
finally
{
pm.close();
}
}
private void checkLoggedIn() throws NotLoggedInException
{
if (getUser() == null)
{
throw new NotLoggedInException("Not logged in.");
}
}
private User getUser()
{
UserService userService =
UserServiceFactory.getUserService();
return userService.getCurrentUser();
}
private PersistenceManager getPersistenceManager()
{
return PMF.getPersistenceManager();
}
}
--
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.