I'm not all that familiar with JPA, but my guess is that applying JPA to a
protocol buffer type is going to be much less efficient than using
protobuf's native encoding.  So you probably want to be serializing your
protobufs with .toByteArray() and then persisting that.

Failing that, you might want to look at the protobuf reflection API (not to
be confused with java reflection) to see if it might be part of a solution:

http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/Message.html

<http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/Message.html>E.g.
maybe you could call message.getAllFields() and then feed the data into JPA
somehow.

On Mon, Sep 13, 2010 at 12:09 PM, roberto_sc <roberto.cal...@gmail.com>wrote:

> Hi
>
> I have a basic question about how to organize my project.
> I have a client  running C# code, a server running Java code and I
> intend to use protocol buffers to exchange data.
> I thought I could use the .proto file to describe the classes of my
> datamodel and generate .java and .cs and then use these generated src
> as my datamodel. But protoc generate code for message exchange and
> cannot be edited, for example, I cannot generate java code for my
> Person class and add the annotations to persist using JPA.
>
> So, the question is, do I have to mantain 3 files - .java, .cs
> and .proto - that represent the same thing?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to