[appengine-java] NPE when trying to retrieve single entity from the datastore
Note that the exception had gone after app has been redeployed. Here is the stack trance: java.lang.NullPointerException at org.datanucleus.store.appengine.InsertMappingConsumer.consumeMapping(InsertMappingConsumer.java:65) at org.datanucleus.store.appengine.DatastoreTable.providePrimaryKeyMappings(DatastoreTable.java:866) at org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer(DatastoreFieldManager.java:1017) at org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer(DatastoreFieldManager.java:998) at org.datanucleus.store.appengine.DatastoreFieldManager.init(DatastoreFieldManager.java:133) at org.datanucleus.store.appengine.DatastoreFieldManager.init(DatastoreFieldManager.java:162) at org.datanucleus.store.appengine.query.DatastoreQuery$3.fetchFields(DatastoreQuery.java:511) at org.datanucleus.state.JDOStateManagerImpl.loadFieldValues(JDOStateManagerImpl.java:841) at org.datanucleus.state.JDOStateManagerImpl.initialiseForHollowAppId(JDOStateManagerImpl.java:284) at org.datanucleus.state.StateManagerFactory.newStateManagerForHollowPopulatedAppId(StateManagerFactory.java:116) at org.datanucleus.ObjectManagerImpl.findObjectUsingAID(ObjectManagerImpl.java:2117) at org.datanucleus.store.appengine.query.DatastoreQuery.entityToPojo(DatastoreQuery.java:522) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.lookupOneToOneChild(DatastoreRelationFieldManager.java:323) at org.datanucleus.store.appengine.DatastoreRelationFieldManager.fetchRelationField(DatastoreRelationFieldManager.java:278) at org.datanucleus.store.appengine.DatastoreFieldManager.fetchObjectField(DatastoreFieldManager.java:269) at org.datanucleus.state.AbstractStateManager.replacingObjectField(AbstractStateManager.java:1197) at com.evo.adm.contract.server.ContractEntity.jdoReplaceField(ContractEntity.java) at com.evo.adm.contract.server.ContractEntity.jdoReplaceFields(ContractEntity.java) at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2772) at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2791) at org.datanucleus.store.appengine.DatastorePersistenceHandler.fetchObject(DatastorePersistenceHandler.java:443) at org.datanucleus.state.JDOStateManagerImpl.loadSpecifiedFields(JDOStateManagerImpl.java:1519) at org.datanucleus.state.JDOStateManagerImpl.isLoaded(JDOStateManagerImpl.java:1925) at com.evo.adm.contract.server.ContractEntity.jdoGetpromotionDetails(ContractEntity.java) at com.evo.adm.contract.server.ContractEntity.getPromotionDetails(ContractEntity.java:175) at com.evo.adm.contract.server.ContractServiceImpl.hackContractToLoadAllInnerFields(ContractServiceImpl.java:651) at com.evo.adm.contract.server.ContractServiceImpl.getContractAsJson(ContractServiceImpl.java:361) at com.evo.adm.contract.server.ContractServiceImpl$$EnhancerByGuice$$29014fb0.CGLIB$getContractAsJson$0(generated) at com.evo.adm.contract.server.ContractServiceImpl$$EnhancerByGuice$$29014fb0$$FastClassByGuice$$67c8617.invoke(generated) at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at com.google.inject.internal.ProxyFactory$1.intercept(ProxyFactory.java:48) at com.evo.adm.contract.server.ContractServiceImpl$$EnhancerByGuice$$29014fb0.getContractAsJson(generated) at com.evo.adm.contract.server.ContractServiceServlet.doPost(ContractServiceServlet.java:160) at com.evo.adm.contract.server.ContractServiceServlet.doGet(ContractServiceServlet.java:134) at javax.servlet.http.HttpServlet.service(HttpServlet.java:693) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:95) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:134) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.evo.adm.SecurityFilter.doFilter(SecurityFilter.java:40) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.wideplay.warp.persist.PersistenceFilter$3.run(PersistenceFilter.java:141) at com.wideplay.warp.persist.internal.Lifecycles.failEarlyAndLeaveNoOneBehind(Lifecycles.java:29) at com.wideplay.warp.persist.PersistenceFilter.doFilter(PersistenceFilter.java:155) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:129) at
[appengine-java] Re: createLoginURL() and Sing-up behavior when running locally under Eclipse debugger?
If you read on on that page, you'll see that: QUOTE: The development server knows how to simulate the Google Accounts sign- in facility. When run on your local machine, the redirect goes to the page where you can enter ANY email address to simulate an account sign- in. This explains your problem, I believe. On 26 feb, 19:48, Mike m...@westforkconsulting.com wrote: Hi, In following along with the example/tutorial from:http://code.google.com/appengine/docs/java/gettingstarted/usingusers The page states that calls to: com.google.appengine.api.users.UserService.createLoginURL() with an email/username that does not have a google account (even when running under Eclipse) will redirect to what appears to be a Google Accounts sign-up page. However, I am unable to trigger that behavior, no matter what text I provide to that control. Any suggestions? Is this a bug or a misprint (or even, a misunderstanding on my part)? Cheers Mike Sheridan -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Possible to cause instance recycling?
I am developing a web app for GAE/J using the Wicket framework, and I too find that my application instances often do not survive one minute before being cycled out (I am the sole source of traffic). One effect of this, within the app start-up delay, is that this takes out my singleton PersistenceManagerFactory instance, so I have to recreate a new one for many interactions with my app. CODE SNIPPETS - private static volatile PersistenceManagerFactory g_pmf = null; // Called before every data exchange with the datastore public static PersistenceManagerFactory getPersistenceManagerFactory() { if (g_pmf == null) synchronized (DataExchange.class)// Non-GAE class { if (g_pmf == null) { loadProperties();// Non-GAE method g_pmf = JDOHelper.getPersistenceManagerFactory(g_sDatabaseMode); } } return g_pmf; } -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Can not fetch record from DB
The first I store UserModel to DB Then I try getting user and my method(see below) return null but I check db and there is stored object I don't know what a problem Help! My method public UserModel getUserByLoginAndPassword(String login, String password) { PersistenceManager pm = getPersistenceManager(); Query getUserQuery = pm.newQuery(UserModel.class); getUserQuery.setFilter(userLogin == vLogin); getUserQuery.setFilter(password == vPassword); getUserQuery.declareParameters(String vLogin, String vPassword); UserModel result = null; try { ListUserModel list = (ListUserModel) getUserQuery.execute( login, password); if (!list.isEmpty()) { result = list.get(0); } } finally { getUserQuery.closeAll(); releasePersistenceManager(pm); } return result; } -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Can not fetch record from DB
second instance of the setFilter() method is the problem. rephrase it to setFilter(userLogin == vLogin password == vPassword) seems like each time you call setFilter() it clears the previously set filters On Sat, Feb 27, 2010 at 5:34 PM, Andriy Andrunevchyn diyko...@gmail.comwrote: The first I store UserModel to DB Then I try getting user and my method(see below) return null but I check db and there is stored object I don't know what a problem Help! My method public UserModel getUserByLoginAndPassword(String login, String password) { PersistenceManager pm = getPersistenceManager(); Query getUserQuery = pm.newQuery(UserModel.class); getUserQuery.setFilter(userLogin == vLogin); getUserQuery.setFilter(password == vPassword); getUserQuery.declareParameters(String vLogin, String vPassword); UserModel result = null; try { ListUserModel list = (ListUserModel) getUserQuery.execute( login, password); if (!list.isEmpty()) { result = list.get(0); } } finally { getUserQuery.closeAll(); releasePersistenceManager(pm); } return result; } -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Can not fetch record from DB
... so your query is wrong. setFilter() sets the filter to what you pass in, so calling it twice sets it to the last thing you set it to. Why not just do pm.newQuery(SELECT FROM + UserModel.class.getName() + WHERE userModel == :login AND password == :password); -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Can not fetch record from DB
Don't work all get methods I've changed method according your advice it didn't help public UserModel getUserByLoginAndPassword(String login, String password) { PersistenceManager pm = getPersistenceManager(); Query getUserQuery = pm.newQuery(UserModel.class); getUserQuery.setFilter(userLogin == vLogin password == vPassword); getUserQuery.declareParameters(String vLogin, String vPassword); UserModel result = null; try { ListUserModel list = (ListUserModel) getUserQuery.execute( login, password); if (!list.isEmpty()) { result = list.get(0); } } finally { getUserQuery.closeAll(); releasePersistenceManager(pm); } return result; } Following method throw strange exception public UserModel getUserByLogin(String login) { PersistenceManager pm = getPersistenceManager(); Query getUserQuery = pm .newQuery(select from UserModel userLogin == vLogin parameters String vLogin); /* * getUserQuery.setFilter(userLogin == vLogin); * getUserQuery.declareParameters(String vLogin); */ UserModel user = null; try { ListUserModel result = (ListUserModel) getUserQuery .execute(login); if (!result.isEmpty()) user = result.get(0); } finally { getUserQuery.closeAll(); releasePersistenceManager(pm); } return user; } org.datanucleus.store.appengine.FatalNucleusUserException: Candidate class could not be found: SELECT FROM UserModel userLogin == vLogin PARAMETERS String vLogin Perhaps I've forgotten some jdo configuration Does anybody know how to fix it? -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Is there a way to interactively browse the content of bigtable in the development environment?
Hello, is there a way to interactively browse the content of bigtable in the development environment? In principle I am looking for something like the quantum eclipse plugin for databases. http://quantum.sourceforge.net/ Many Thanks, Christian -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] sending mails using appengine mail service
hello everyone, I am trying to send mail using app engine mail service but its not happening for me..can anybody help me... I have tried the example snippet from appengine... -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: sending mail in google app engine in java
Hi laxmi, I'm also trying to send mail thru appengine. My code is as follows package outlooky; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; class AuthServlet extends HttpServlet { private static final long serialVersionUID = 1L; public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { BufferedReader rd = null; rd = new BufferedReader(new InputStreamReader(req.getInputStream())); String msgBody = new String(rd.readLine()); sendEmail(msgBody); } public void sendEmail(String title) { Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(outlooky-te...@appspot.com)); msg.addRecipient(Message.RecipientType.TO,new InternetAddress(sandy1man...@gmail.com)); msg.setSubject(the wave + title + was updated); msg.setText(it was updated!); Transport.send(msg); } catch (AddressException e) { // ... } catch (MessagingException e) { // ... } } } But I'm not getting any logs in my app and also its not showing me any sent mail... can u tell me where is the actual problem is? -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Strange issue with a where condition in JPA query
Hi all, I have the follow table: Message id, name 1, t...@example 2, other_value 3, other_value 1, t...@example in my application I perform this simple query: select m from Message m where m.confirmed = true and m.name = 't...@example' But doesn't works, while select m from Message m where m.confirmed = true and m.name = 'other_value' works well. Why? I don't understand what happens :) Thank to everyone. Davide -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Is there a way to interactively browse the content of bigtable in the development environment?
Sorry, just after sending my mail I found the answer: http://code.google.com/appengine/docs/java/tools/devserver.html#The_Development_Console Christian Schuhegger wrote: Hello, is there a way to interactively browse the content of bigtable in the development environment? In principle I am looking for something like the quantum eclipse plugin for databases. http://quantum.sourceforge.net/ Many Thanks, Christian -- Christian Schuhegger http://www.el-chef.de/ -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] Re: Serialized field is ignored in JDO
The datastore is schema-less, but the datastore requires a schema - this is done by scanning the local datastore and trying to determine the schema from the saved entities. This behavior seems to make sense to me, as we generate the view from the actual data itself and not from the class definitions. For instance, if you define an entity Profile, before you actually persist a Profile instance, the datastore viewer won't even be aware that Profile entities exist. On Fri, Feb 26, 2010 at 11:29 PM, Arnold arnold.mi...@gmail.com wrote: Thanks Max, that solves it. The datastore viewer in development console kind of misled me to think the field is not persisted at all. I have noticed that after adding records with the serialized field set, the serialized field column is not shown in the datastore viewer. But, as soon as I add one record with the serialized field == null, the column is shown in the datastore viewer. Could this be a bug or there is something more that I am missing? On Feb 26, 12:28 pm, Max thebb...@gmail.com wrote: how about defaultFetchGroup = true ? On Feb 25, 9:18 pm, Arnold arnold.mi...@gmail.com wrote: Two classes are defined: -- @PersistenceCapable(identityType=IdentityType.DATASTORE, detachable=true) public class TestSerialized { @Persistent private String nonSerialized; @PrimaryKey() @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Key primaryKey; @Persistent @Serialized private SerializedObj serializedObj; } public class SerializedObj implements Serializable{ /** * */ private static final long serialVersionUID = 6258869487732411716L; private String value; public SerializedObj() { } public SerializedObj(String value) { this.value = value; } } -- When a TestSerialized is persisted like below, the nonSerialized field works fine but the serializedObj field is not saved to the datastore, and looking into the development console, the field/column is not even created: PersistenceManager pm = PMF.get().getPersistenceManager(); try{ pm.currentTransaction().begin(); TestSerialized draft = new TestSerialized(); draft.setSerializedObj(new SerializedObj(dd)); pm.makePersistent(draft); pm.currentTransaction().commit(); }finally{ if(pm.currentTransaction().isActive()){ pm.currentTransaction().rollback(); } pm.close(); } @Persistent(serialized=true) didn't help either. Am I missing something? I am using SDK 1.3.1 . Thanks. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- Ikai Lan Developer Programs Engineer, Google App Engine http://googleappengine.blogspot.com | http://twitter.com/app_engine -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: way to interactively query datastore?
Yes, it allows all characters in property and kind names as long as GAE/Bigtable supports them. So for normal property and kind names the GQL query looks like: SELECT * FROM MyEntity WHERE myProperty='myvalue' But when you need to use GQL's unsupported characters, or when the whole kind or property name is a GQL keyword, then just escape it by apostrophes (like strings): SELECT * FROM 'Order' WHERE 'com.foo.my.property'='myvalue AND 'limit'=1 But be aware that this is not the official GQL syntax - it works only in our parser's implementation. Vaclav On Feb 26, 5:01 pm, John Patterson jdpatter...@gmail.com wrote: Very cool! Does it allow '.' in property names? Unfortunately the Datastore Viewer doesn't . On 26 Feb 2010, at 22:30, vbart wrote: Last night we released a new version including improved GQL dynamic parser. Operators != and IN are supported now and also several bugs were fixed. More info athttp://audao.spoledge.com/doc-gae-features.html#gqlparser Vaclav On Feb 24, 11:00 pm, David Lam david.k.l...@gmail.com wrote: On Wed, Feb 24, 2010 at 1:37 AM, vbart vaclav.barta...@spolecne.cz wrote: I can offer only listing solution, based on our free GQL dynamic parser -http://audao.spoledge.com/download.jsp The full JSP you can find here: http://vaclavb.blogspot.com/2010/02/google-app-engine-data-viewer-gql ... The GQL parser (class GqlDynamic) converts GQL queries into low- level datastore API calls, so the basic code of fetching entities can be: import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import com.spoledge.audao.parser.gql.GqlDynamic; import java.util.List; ... GqlDynamic gqld = new GqlDynamic(); gqld .setDatastoreService ( DatastoreServiceFactory.getDatastoreService()); String gql = SELECT * FROM MyEntity WHERE prop1='test' ORDER BY prop2 LIMIT 10; ListEntity result = gqld.prepareQuery( gql ).asList( gqld.getFetchOptions()); Then you just need to render the result in a JSP page. The GQL parser currently does not support operators '!=' and 'IN', but we are going to launch a new version in a few days which will support all GQL features. Vaclav hmm thanks for the tip! i actually was unaware the way to do something like this was to build a google datastore.Query to represent the GQL statement... -- 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 google-appengine-java@googlegroups.com . To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/google-appengine-java?hl=en . -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] lost sub entity
Hi, I have problem with reordering a List. I created a test with an entity called MyEntity which have a ListSubEntity. First I persist one instance of MyEntity with a list containing 3 SubEntity. This works fine. Then I call a reorder servlet that moves the first SubEntity to the last position in the list. The result is that the first SubEntity is lost and the datastore only contains 2 SubEntity instances. What can be wrong? Here is the reorder code: package com.google.appengine.demo; import java.io.IOException; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings(serial) public class ReorderServlet extends HttpServlet { @SuppressWarnings(unchecked) public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(MyEntity.class); Transaction tx = pm.currentTransaction(); try { tx.begin(); ListMyEntity results = (ListMyEntity) query.execute(); if (results.iterator().hasNext()) { for (MyEntity e : results) { ListSubEntity list = e.getMyList(); SubEntity first = list.remove(0); boolean ok = list.add(first); if (!ok) { System.err.println(could not add first); } System.out.println(list); pm.makePersistent(e); tx.commit(); } } } catch (Exception e) { e.printStackTrace(); } finally { if (tx.isActive()) tx.rollback(); query.closeAll(); pm.close(); } resp.setContentType(text/plain); resp.getWriter().println(reordered); } } -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: Serialized field is ignored in JDO
Thanks Ikai for the explanation. That makes a lot of sense. But in this case, the entity is seen by the datastore viewer, and I can see all other columns EXCEPT the @Serialized column, even though that column has entities with data in that column. Let me put this in other words: As long as you have persisted only entities with the @Serialized field set to something other than null, then the datastore viewer does not display the @Serialized field even though all the records have data in that field's column. And then as soon as you persist an entity that has that @Serialized field set to null, the datastore viewer begins to show the @Serialized field's column, in which all the previous records have something like Blob: 462 bytes in the the column that was previsously unseen. On Feb 27, 8:33 pm, Ikai L (Google) ika...@google.com wrote: The datastore is schema-less, but the datastore requires a schema - this is done by scanning the local datastore and trying to determine the schema from the saved entities. This behavior seems to make sense to me, as we generate the view from the actual data itself and not from the class definitions. For instance, if you define an entity Profile, before you actually persist a Profile instance, the datastore viewer won't even be aware that Profile entities exist. On Fri, Feb 26, 2010 at 11:29 PM, Arnold arnold.mi...@gmail.com wrote: Thanks Max, that solves it. The datastore viewer in development console kind of misled me to think the field is not persisted at all. I have noticed that after adding records with the serialized field set, the serialized field column is not shown in the datastore viewer. But, as soon as I add one record with the serialized field == null, the column is shown in the datastore viewer. Could this be a bug or there is something more that I am missing? On Feb 26, 12:28 pm, Max thebb...@gmail.com wrote: how about defaultFetchGroup = true ? On Feb 25, 9:18 pm, Arnold arnold.mi...@gmail.com wrote: Two classes are defined: -- @PersistenceCapable(identityType=IdentityType.DATASTORE, detachable=true) public class TestSerialized { @Persistent private String nonSerialized; @PrimaryKey() @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Key primaryKey; @Persistent @Serialized private SerializedObj serializedObj; } public class SerializedObj implements Serializable{ /** * */ private static final long serialVersionUID = 6258869487732411716L; private String value; public SerializedObj() { } public SerializedObj(String value) { this.value = value; } } -- When a TestSerialized is persisted like below, the nonSerialized field works fine but the serializedObj field is not saved to the datastore, and looking into the development console, the field/column is not even created: PersistenceManager pm = PMF.get().getPersistenceManager(); try{ pm.currentTransaction().begin(); TestSerialized draft = new TestSerialized(); draft.setSerializedObj(new SerializedObj(dd)); pm.makePersistent(draft); pm.currentTransaction().commit(); }finally{ if(pm.currentTransaction().isActive()){ pm.currentTransaction().rollback(); } pm.close(); } @Persistent(serialized=true) didn't help either. Am I missing something? I am using SDK 1.3.1 . Thanks. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2B unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- Ikai Lan Developer Programs Engineer, Google App Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] lost sub entity
dont you get any exceptions stacktrace in the server console? it would help... also you are calling commit() inside the for loop, although the transactions is started only once... that would crash in the second iteration in a normal db server, I am not sure what GAE does with it, in any case I dont think it is what you intended... On Sat, Feb 27, 2010 at 2:52 PM, Gunnar gunnar@gmail.com wrote: Hi, I have problem with reordering a List. I created a test with an entity called MyEntity which have a ListSubEntity. First I persist one instance of MyEntity with a list containing 3 SubEntity. This works fine. Then I call a reorder servlet that moves the first SubEntity to the last position in the list. The result is that the first SubEntity is lost and the datastore only contains 2 SubEntity instances. What can be wrong? Here is the reorder code: package com.google.appengine.demo; import java.io.IOException; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings(serial) public class ReorderServlet extends HttpServlet { @SuppressWarnings(unchecked) public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(MyEntity.class); Transaction tx = pm.currentTransaction(); try { tx.begin(); ListMyEntity results = (ListMyEntity) query.execute(); if (results.iterator().hasNext()) { for (MyEntity e : results) { ListSubEntity list = e.getMyList(); SubEntity first = list.remove(0); boolean ok = list.add(first); if (!ok) { System.err.println(could not add first); } System.out.println(list); pm.makePersistent(e); tx.commit(); } } } catch (Exception e) { e.printStackTrace(); } finally { if (tx.isActive()) tx.rollback(); query.closeAll(); pm.close(); } resp.setContentType(text/plain); resp.getWriter().println(reordered); } } -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en. -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
Re: [appengine-java] lost sub entity
This should be throwing an exception. The JavaDocs for Transaction.commit() say Commits the transaction. Whether this call succeeds or fails, all subsequent method invocations on this object will throw IllegalStateException. When something does not work as you expect the first place to look is the logs under your application console. On 28 Feb 2010, at 05:25, Karel Alvarez wrote: dont you get any exceptions stacktrace in the server console? it would help... also you are calling commit() inside the for loop, although the transactions is started only once... that would crash in the second iteration in a normal db server, I am not sure what GAE does with it, in any case I dont think it is what you intended... On Sat, Feb 27, 2010 at 2:52 PM, Gunnar gunnar@gmail.com wrote: Hi, I have problem with reordering a List. I created a test with an entity called MyEntity which have a ListSubEntity. First I persist one instance of MyEntity with a list containing 3 SubEntity. This works fine. Then I call a reorder servlet that moves the first SubEntity to the last position in the list. The result is that the first SubEntity is lost and the datastore only contains 2 SubEntity instances. What can be wrong? Here is the reorder code: package com.google.appengine.demo; import java.io.IOException; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings(serial) public class ReorderServlet extends HttpServlet { @SuppressWarnings(unchecked) public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PersistenceManager pm = PMF.get().getPersistenceManager(); Query query = pm.newQuery(MyEntity.class); Transaction tx = pm.currentTransaction(); try { tx.begin(); ListMyEntity results = (ListMyEntity) query.execute(); if (results.iterator().hasNext()) { for (MyEntity e : results) { ListSubEntity list = e.getMyList(); SubEntity first = list.remove(0); boolean ok = list.add(first); if (!ok) { System.err.println(could not add first); } System.out.println(list); pm.makePersistent(e); tx.commit(); } } } catch (Exception e) { e.printStackTrace(); } finally { if (tx.isActive()) tx.rollback(); query.closeAll(); pm.close(); } resp.setContentType(text/plain); resp.getWriter().println(reordered); } } -- 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 google-appengine-java@googlegroups.com . To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en . -- 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 google-appengine-java@googlegroups.com . To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en . -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: sending mails using appengine mail service
Can you post the error (if any), or a code sample of what you are attempting? On Feb 27, 4:39 pm, santosh mantri sandy1man...@gmail.com wrote: hello everyone, I am trying to send mail using app engine mail service but its not happening for me..can anybody help me... I have tried the example snippet from appengine... -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Text fields in dev console
I don't see the Text fields of persisted objects when listing the entities from the Development Console. E.g., using JDO, I have Text field foo, as declared below: @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = true) public class LocationData implements Serializable { ... @Persistent(defaultFetchGroup = true) Text foo; ... Should I expect the viewer to display the contents of foo, or should I assume that the viewer simply does not list it since it may be (and actually is) quite long (500 char)? -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.