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 8629135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:43:27+00:00 2026-06-12T08:43:27+00:00

We use protocol buffers for storing data in a database (as blobs). At some

  • 0

We use protocol buffers for storing data in a database (as blobs). At some point, we read them again, need to modify them and store them again.

The problem is, protocol buffer message objects are immutable. What we had in mind was just creating a new builder object using the protocol buffer message as prototype:

Foo.Builder.newBuilder(prototype)

This basically works. But as we have a nested structure, so the prototype object actually contains attributes which are messages themselves, this does not work. Excerpt from the documentation:

Since embedded message and string objects are immutable, they are shared between the original and the copy.

Is there a way of cloning a whole structure to new builder objects which are mutable?

  • 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-12T08:43:29+00:00Added an answer on June 12, 2026 at 8:43 am

    Well, sort of. I’ve done this using DynamicMessage.Builder, Descriptor and FieldDescriptor. I recursively walk the object graph using a fully qualified name to the property I want to update. Once found, I update it and call build on the DyynamicMessage.Builder(s) back up the stack. It is not straight forward particularly when dealing with repeated fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Protocol buffers to store serialized data in Database for
I'd like to use protocol buffer in my program to read data from a
I'm considering to use Protocol Buffers for data exchange between a Linux and a
I'm trying to use Protocol Buffers for message serialization. My message format should contain
I'm trying to use Google Protocol Buffers in my project and I'd like to
I am wondering how I can use google protocol buffers to accept a request
I'm trying to use extensions with Google's Protocol Buffers. I've got one main proto
Could someone please help and tell me how to use protocol buffers. Actually I
Inside a Java project I use Google Protocol Buffers (GPB) for serializing my objects.
Is it possible to use google protocol buffers as the serialisation mechanism when only

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.