I have stored about 50,000 entities in Appengine. I can use the following query to query a single record through the GQL management interface:

SELECT * FROM Pet where __key__ = KEY( 'Pet','Fido')

But I am having trouble figuring out how to do batch processing via JDO. Now I have this:

PersistenceManager pm = ...; for(Pet pet : pets) { for(String k : getAllAliases(pet)) { keys.add(KeyFactory.createKeyString(Pet.class.getSimpleName(), k)); } } Query q = pm.newQuery("select from"+ Pet.class.getName() +"where id == :keys"); Listpetlist = (List) q.execute(keys);

However, even though'Fido' is valid in the GQL case, when I use the Java JDO code, it returns nothing. What am I doing wrong?

Solution:

Don't use query buttons to retrieve entities-they are inefficient and require a query for each retrieved object! Instead, get the objects by key.JDO doesn't seem to support batch fetching by keystroke, but fetching by one keystroke is still much more effective than querying them.

java-how to perform batch processing in JDO Google DataStore key lookup query Related posts

  1. java-catalina.bat?

    I'm inheriting a project, and (following other developers' instructions) overwrite my Tomcat version with his Tomcat version of catalina.bat (he is using the same version). Then, I tried to restart Tomcat and got Exception related to commons-logging.jar, which is a Tomcat dependency.After a lot of frustration, I just downloaded another version of Tomcat and tried to run it immediately (without configuration)... and I encountered the same error!So I asked this question on SO a few days ago. The c ...

  2. Convert Window BAT (batch) file to Python script

    I have a Window .bat file that contains DOS commands for REM, MKDIR, ECHO, which runs some programs, and in particular merges all output into a log file with timestamps. I want to translate it to Python.I tried os.system, but it doesn't work - it runs the program I need to run, but fails to concaten ...

  3. java - use ProcessBuilder to run msys.bat

    I'm trying to run msys.bat in Java using ProcessBuilder. When I run the .bat file with the program, the following error occurs:"Could not find rxvt.exe or sh.exe binary - aborting. Please press any key to continue... ."Here is the code,ProcessBuilder Msys = new ProcessBuilder("C:/msys/1.0/msys.bat", ...

  4. Python bat modify environment variables in two ways

    bat modify variables The method is from the following link, please check Baidu experience and click to open Steps: Create a new Text text, then enter setx PATH=%PATH%; you need to add the path of the variable and then modify the suffix of the Text text file to ".bat" For the ...

  5. bat Determine whether the computer has a network to execute different programs

    The batch process bat judges whether the computer has a network to execute different programs. If reprinted, please indicate the source of [email protected] off :Ping choice /t 5 /dy /n >nul ping -n 3 www.hao123.com >nul IF ERRORLEVEL 1 goto Start2 IF ERRORLEVEL 0 goto Start1 :Start1 start"""Pat ...

  6. Interview Algorithm LeetCode Brushing Class—BAT interviewer takes you to brush the real questions Video Tutorial

    Interview algorithm LeetCode brushing class - BAT interviewer takes you to brush real questions video tutorialDetailed description of the Java video tutorial: A0195"Interview Algorithm LeetCode Brushing Class - BAT Interviewer Takes You to Brush the Real Questions Video Tutorial"Mastering algorithms ...

  7. java-pass parameters to the jar file called in the bat file?

    I have created a jar that needs to be called in a bat file. I need to pass all the command line parameters received by the bat file to the jar. Can anyone help me. I know this is a stupid question, but I am concerned about the jar and Bat knows nothing. I can't find a combination of the two online. Please also note that I don't know how to fix the command line parameters in the bat file.Solution:In your bat file you will have java commands just use java -jar helloworld.jar firstParam secondParam ...

  8. become a BAT interview harvester? Offer received soft

    The Android system is huge and intricate. Today I will lead you to explore the overall architecture of the Android system and get a glimpse of it.introductionAs the beginning of the Android system architecture, this article serves as an outline and guide. It outlines the core technical points of the ...

  9. java collection of BAT interview written test

    33 BAT interview questions: classic interview questions such as JavaList and Java Map! Summary of answers! Summary of JavaList interview questions 1. List collection: ArrayList, LinkedList, Vector, etc.2. Vector is a thread-safe collection under the List interface.3. List is ordered.4. The data structure of ArrayList and LinkedList are different. The former is used for more queries, and the latter is suitable for more inserts.5. ArrayList uses an array structure, and LinkedList uses a linked lis ...

  10. [through BAT] java basic summary

    1. Data Typebasic typetype of packagingbuffer pool2. StringOverviewImmutable benefitsString, StringBuffer and StringBuilderString Poolnew String(“abc”)3. OperationParameter passingfloat 与 doubleimplicit type conversionswitch4. Inheritanceaccess permissionabstract classes and interfacessuperOverridin ...

  11. How to run bat file from C# program?

    So I need a simple function to run the bat file. How to do such a thing?Solution:Take a look at Process.StartIn the simplest form, you can call it like thisProcess.Start("thebatchfile.bat") ...

  12. The road of Java engineer training (two years of learning from Xiaobai to BAT)

    PrefaceI am one of the 985 masters of the cross-professional slag postgraduate entrance examination. After two years of study and accumulation of graduate students, I was fortunate to get R&D job offers from several companies in the autumn recruitment of 2019, including Baidu, Ali, Tencent, Tout ...

  13. If you don't know Java's JVM, it is really difficult to enter the first-tier BAT factory!

    Preface For developers, if they do not understand Java's JVM, it is really difficult to write good code and find good bugs. At the same time, the JVM is also the hardest hit area in the interview process. We can't interview for interview's sake, but if you learn these core knowledge, you will defini ...

  14. permanently use bat command to set Java environment variable value

    I wrote a bat script to set the java path in environment variables. I set the path using the following command -setx PATH=%jdkDirDest%\bin;%PATH%.setx PATH=%playDirDest%;%PATH%.set PATH=%jdkDirDest%\bin;%PATH%.set PATH=%playDirDest%;%PATH%.When I use the current session it works fine, but what happe ...

  15. Java programmers who want to enter the BAT interview, do you still find it difficult to get an offer after reading this?

    The first question: What does Ali ask in the interviewAttending Ali’s social recruitment interview. Social recruitment is different from school recruitment. The scope of the questions is actually very random. Because more than 70% of those who can participate in the recruitment of some of the more well-known Internet companies will have 3-5 years of experience . This is not to say that students with one or two years of experience do not have the opportunity to join these companies, but because t ...

  16. The group laughed: 985 programmers went to BAT, high school teachers are not good at coding

    A programmer ridiculed in the Internet community. He called it 985 colleges and universities. All the best in computer science went to companies like BAT, but those who went to high school as teachers were not very good. They had no coding ability, so they could only teach. !Obviously, such slobber ...

Recent Posts

  1. When using Jaspyt to encrypt Spring properties file, is the environment variable really a safe place to store the master password?

    I'm using Jaspyt and Spring 3 in a Java project. I currently store the database connection properties in a properties file. The username and password are in plain text, so I've been using Jaspyt's EncryptablePropertyPlaceholderConfigurer.Documentation and tutorials suggest storing the master passwor...

  2. Node.js Write a simple static server 5 MIME

    MIME - Multipurpose Internet Mail Extensions, which is an Internet standard for describing types of message content.http://www.w3school.com.cn/media/media_mimeref.aspThe"Content-Type"we set earlier in the code is"text/plain"and"text/html". Is to set two different MIME.We also use"application/javascr...

  3. python - Django cannot import login from django.contrib.auth.views

    I try to build a login function for my page. To edit urls.py, go ahead and print:cannot import name 'login' from 'django.contrib.auth.views'How can I deal with this problem?from django.contrib.auth.views import loginfrom django.urls import pathfrom . import viewsapp_name ="users"urlpatterns = [ path...

  4. "Source Code Analysis" - ten minutes to understand the implementation principle of HashMap

    ◣It is already spring and March outside, I believe that the days that should be noisy, crowded, and busy will soon recover◢BUG sharing areaBefore entering the topic, let me share with you a small problem that I have encountered in the past few days. My mind is full of"children, do you have a lot of ...

  5. remove automatic gaps between gridded python Tkinter widgets

    I'm using python2 on Windows. When I run the followig code, there is a gap between the two canvases (see image below), although no padding is specified when meshing them. Is it possible to remove this?import Tkinter as tkimport ttkclass App(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__...

  6. java – how to adjust the scroll position in the scroll pane

    I created JTextpane and inserted components (components like Jtextarea) in textpane. (Vertical scrollbar) When I insert new component in JTextpane, JTextpane's Jscrollpane is automatically set to bottom. I want it to stay on top location. How can I do thisThank you Sunil Kumar SahooSolution:This is ...

  7. SHA1 Checksum is different for the same file in php and android

    I generate SHA1 keys in PHP and Android to authenticate files. But I get different keys for PHP and Android.Android:try { MessageDigest digest = MessageDigest.getInstance("SHA-1"); byte[] buffer = new byte[65536]; InputStream fis = new FileInputStream(downloadFile.getPath()); int n = 0; while (n != ...

  8. javascript - how to copy object from chrome console window?

    I tried to copy the object as text, but it only shows [object object]. I have tried copying before this and it says it is successful but not now. Is that a chrome issue?what have i tried? Just right click on the object and store as a global variable from the chrome console window, then next just use...

  9. Using java to upload files in Google cloud storage

    I've been trying to upload files in Google Cloud Storage using java for a long time. Through goggling I found this code but couldn't understand exactly. Can anyone customize this one to upload files in GCS. Can anyone help I solve this problem.// GivenInputStream inputStream; // object data, e.g., F...

  10. javascript-Appium/Protractor rotating screen on real device

    I can't rotate the screen to landscape on an actual device. The tests are written in JS.capabilities: { orientation: 'landscape', platformName: 'Android', platformVersion: '5.0.2', ...},The application is built using the Ionic framework.I am using a configuartion like thisHas anyone encountered this...