Forum: Building VoltDB Applications

Post: Can i use java objects in Stored Procedure

Can i use java objects in Stored Procedure
Jan 4, 2013
Hi all

i'm very new to Volt DB and SQL.i have some doubts regrading usage of Stored Procedures.

I'm using volt db java client interface.

in my application i'm sending byte array of java object as a argument to stored procedure.

Actually my plan is in my Stored Procedure class i want to deserialize byte array to normal java object,from this java object i want to extract fields and fill into sql statements. but this plan is not working.

Volt Compiler creating jar for only .classes of StoreProcedure objects but these objects are depend on my java domain classes. so how to include my java classes in catalog jar file

Possible to hack around, though not supported formally.
Jan 7, 2013
Hi Ramesh,

Including non-procedure classes is something we're going to address in 2013, as we acknowledge the tools provided are awkward for certain use cases.

For the time being, there are a couple of things you can do.

1. Nested classes within procedures will get put in the catalog.
2. Procedures don't have to be called; you can subclass VoltProcedure and use the class for other stuff.
3. You can put jars/classfiles in the classpath of the server on each node and call them from procedures. However, this code won't be transactionally updated if you update the catalog.