Hello I create a gae project by template
As I work with eclipse plugin the jdoconfig.xml has been generated and
the datanucleus.jar files (3) are in the WEB-INF lib path
add a java basic UserApp class (pojo without any annotation) (this
class must not be modifed else I would have add annotation nut this is
not possible)
add a PMF.java to retrieve Persistant Manager (code from google
appengine JDP tutorial page)
create a package.jdo declaration file that I place in the same package
I moify defaut gae servlet to make a jdo test
public static UserApp insertNewApp(UserApp userBuilder) {
PersistenceManager pm = PMF.get().getPersistenceManager();
pm.makePersistent(userBuilder);
System.out.println(
"The ID of the new entry is: " + userBuilder.getId());
return userBuilder;
}
I did not modify jdoconfig.xml and perhaps I miss something here but I
don't know how to declare my package.jdo in the jdoconfig.xml
Off course When I start the project as Gae project in eclipse, I have
an error
The class "The class "test.gae.UserApp" is not persistable ...
Meta-Data/annotations for the class are not found
If someone can eplain me the step I miss to make all of this works,
this would be great
ps the file package.jdo has been renamed to fit this forum restriction
--
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 [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-java?hl=en.
<?xml version="1.0"?>
<!DOCTYPE jdo SYSTEM "file:/javax/jdo/jdo.dtd">
<jdo>
<package name="test.gae">
<class name="UserApp" table="UserData">
<field name="id" primary-key="true"/>
<field name="name"/>
<field name="email"/>
<field name="externalId"/>
</class>
</package>
</jdo>package test.gae;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-optional");
private PMF() {}
public static PersistenceManagerFactory get() {
return pmfInstance;
}
}package test.gae;
import java.io.IOException;
import javax.jdo.PersistenceManager;
import javax.servlet.http.*;
@SuppressWarnings("serial")
public class Test_gae_servletServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
UserApp userBuilder = new UserApp();
userBuilder.setId(10L);
userBuilder.setName("name1");
userBuilder.setEmail("mail1");
userBuilder.setExternalId("external1");
insertNewApp(userBuilder);
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
public static UserApp insertNewApp(UserApp userBuilder) {
PersistenceManager pm = PMF.get().getPersistenceManager();
pm.makePersistent(userBuilder);
System.out.println(
"The ID of the new entry is: " + userBuilder.getId());
return userBuilder;
}
}
package test.gae;
import java.io.Serializable;
public class UserApp {
private Long id;
/** The corresponding id of this user for facebook / opensocial / openId*/
private String externalId = null;
private String name = null;
private String language = null;
private String email = null;
private Long preferedChannelListId = null;
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setLanguage(String language) {
this.language = language;
}
public String getLanguage() {
return language;
}
public void setEmail(String mail) {
this.email = mail;
}
public String getMail() {
return email;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
public String getExternalId() {
return externalId;
}
public void setPreferedChannelListId(Long preferedChannelListId) {
this.preferedChannelListId = preferedChannelListId;
}
public Long getPreferedChannelListId() {
return preferedChannelListId;
}
}