How to use Protobuf with existing ORM(torque)?

659 views
Skip to first unread message

sansun08

unread,
Nov 9, 2009, 1:03:01 AM11/9/09
to Protocol Buffers
We use <a href="http://db.apache.org/torque/index.html">apache torque</
a> as ORM in our project. The DAOs( torque auto generates the DAO
classes based on the schema design) generated are quite complex( since
our database schema design is really complex). We use readExternal and
writeExternal to deserialize /serialize objects. We already face some
serious performance issues when the data is large. I think protobuf
can definitely make things better for our case. Is there a way to
integrate Protobuf classes with our existing DAO model?

sansun08

unread,
Nov 9, 2009, 8:32:42 PM11/9/09
to Protocol Buffers
I am not asking specific to torque. Were there any successful attempt
in integrating with any of the famous ORMs like hibernate or JPA?

sansun08

unread,
Nov 9, 2009, 9:47:09 PM11/9/09
to Protocol Buffers
To be more precise, how do I avoid the inner class implementations in
the auto-generated code by protobuf(java). I want the java file name
to be same as the Message name which also implies that the message
class should not be an inner class. Is there a way to achieve this(In
short similar to DAO classes used by ejb or hibernate)?

Kenton Varda

unread,
Nov 9, 2009, 9:51:09 PM11/9/09
to sansun08, Protocol Buffers
Add this to your .proto file:

  option java_multiple_files = true;

Note that the outer class is still generated, it just doesn't contain the other classes.  You can still change the outer class name with:

  option java_outer_classname = "Whatever";

Sankaravadivel S

unread,
Nov 10, 2009, 4:56:23 AM11/10/09
to Kenton Varda, Protocol Buffers
Thanks. That worked me.
Reply all
Reply to author
Forward
0 new messages