Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7974267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:19:31+00:00 2026-06-04T08:19:31+00:00

I use Google Appengine Datastore Blob to store images, but I want to use

  • 0

I use Google Appengine Datastore Blob to store images, but I want to use Blobstore instead. I need to move all the existing blobs to Blobstore.
What is the best way to do it with GAE for Java?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:19:33+00:00Added an answer on June 4, 2026 at 8:19 am

    I solved the problem using MapReduce as Nick Johnson suggested:

    Check the project:

    http://code.google.com/p/appengine-mapreduce/

    And great tutorial by Ikai Lan:

    http://ikaisays.com/2010/07/09/using-the-java-mapper-framework-for-app-engine/

    This is how the map method could look like:

    @Override
    public void map(Key key, Entity value, Context context) {
        log.info("Mapping key: " + key);
    
        try {
    
            Entity picture = value;
    
            if (!picture.hasProperty("blobKey") || picture.getProperty("blobKey") == null) {
                String fileName = (String) picture.getProperty("fileName");
                String contentType = (String) picture.getProperty("contentType");       
                Blob image = (Blob) picture.getProperty("image");       
    
                if (contentType != null && image != null) {
    
                    AppEngineFile file = fileService.createNewBlobFile(contentType,fileName);         
                    FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);         
                    writeChannel.write(ByteBuffer.wrap(image.getBytes()));
                    writeChannel.closeFinally();
    
                    BlobKey blobKey = fileService.getBlobKey(file);     
    
                    picture.setProperty("blobKey",blobKey);
                    datastore.put(picture);
                }
                else {
                    log.log(Level.SEVERE, "Mapping key: " + key + "failed - null contentType or image.");
                }
    
            }
        } catch (Exception e) {
            log.log(Level.SEVERE, "Mapping key: " + key, e);
    
        }
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I store user-uploaded images in the Google App Engine datastore as db.Blob , as
I use the com.google.appengine.api.datastore.Blob type in my web-application. As it's mentioned in reference the
I'm using the Google AppEngine, with Java. When I use some datastore features, I'm
I try to learn use JDO in GWT from https://developers.google.com/appengine/docs/java/datastore/jdo/creatinggettinganddeletingdata In the first sample
On Google App Engine to query the data store with Python, one can use
I have a ~2MB file that my Google AppEngine server must use (not serve)
I am trying to use the google appengine python SKD from my ubuntu lucid.
Take a look at the first example of http://code.google.com/intl/sv-SE/appengine/docs/java/datastore/jdo/relationships.html (Owned One-to-One Relationships). I dont
I'm still fairly new to working with java and the google appengine datastore. I
I'm using the appengine datastore, and all of my entities have Long ids as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.