Thursday, April 25, 2013

Re: Entity not persisted, using JDO,RequestFactory.

I am able to persist this entity in a servlet with following code:

PersistenceManager pm = PMF.getInstance().getPersistenceManager();
User abcd = new User();
abcd.setEmail("email@email.com");
abcd.setName("name");
VerificationToken token1 = new VerificationToken(abcd,VerificationToken.VerificationTokenType.emailVerification,60);
if(abcd!=null&&token1!=null)
abcd.addVerificationToken(token1);
else
System.err.println("Why me!");
Poll poll = new Poll();
poll.setQuestion("Hello Good Morning");
List<String> options = new ArrayList<String>();
options.add("option 1");
options.add("option 2");
poll.setOptions(options);
poll.setUser(abcd);
poll.setCloseTime(new Date());
pm.makePersistent(abcd);
pm.makePersistent(poll);
pm.close();

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment