users ....
unread,Nov 2, 2011, 12:24:37 PM11/2/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Protocol Buffers
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.
Thanks,
Mike