I am working on a solution to basically allow me to persist any
protocol buffer with hibernate.  However, I have run into a challenge
with nested builders.  In order for hibernate to create relationships
it's requiring the parent object be referenced.  For these purpose I
wanted the parent object to be a builder.  However, in the case of a
nested repeated message field (see example below), upon adding the
builder to the parent the generated code actually builds the object.
You can start to work around this for one level nesting but beyond
that it's really ugly.

message Parent {

  repeated Child = 1;

message Child {
  repeated GrandChild = 1;

message GrandChild {
   optional int32 id = 1;

The problem is that hibernate want's linkage between Java objects and
the builder to message conversions actually destroy this
relationship.  My question is why are the objects being built before I
call build and is there any way to fix this?  I'd be happy if they
would all be builders until the parent build call is made.



You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to