views:

36

answers:

1

I'm working on a mobile app that will get data from GAE, and I'm trying to decide between using Protocol Buffers and JDO. First off, I'm not sure how to make PBs persistent. I know it's just a matter of the annotation tags with JDO.

I also saw this thread where they warn that PB data can't be indexed. I'm not sure if that's a problem for me or not, though. Is there a happy medium, like a way to use JDO for persistence, but use PB for communication?

Thanks

Edit: Sounds like the initial consideration was a bad idea, but I'm still wondering if I can get the benefit of using PBs just for transmitting data to the client. Would the overhead of converting JDO objects to PB objects for transmission to the client outweigh the benefits of PBs? Actually, it sounds like that's exactly what happens internally on GAE, anyway, so that probably means it's a good way to go...

+1  A: 

Protocol Buffers aren't meant for persistence, they're for encoding and decoding data efficiently for data transmission.

App Engine uses protobufs internally to send your data around and to persist your entities in the datastore, but that's not the interface you want to use to store data in your application.

You want to use JDO.

Jason Hall
I'm already using JDO for persistence, so I guess that's good I won't have to redo that code. But PB is still a good method for client-server communication, right? The mobile app doesn't send data, only receives, so would I want to create similar MyJdoObject and MyProtoObject and only use the PB version for communication?
ASTX813
@ASTX813 If you're talking about using PBs for transmitting data between client and server, you really need to clarify your question - how is the decision between PBs and JDO, in that case?
Nick Johnson
@Nick When I asked the original question, I was thinking of replacing my JDO implementation of my object with a PB version. Jason's answer convinced me that was unwise, but now I'm wondering if I can use PB just for transferring data to the Android clients.
ASTX813
@ASTX813 You certainly can - but a new question where you detail your specific needs and concerns would probably be the best bet. :)
Nick Johnson

related questions