views:

93

answers:

1

With Hibernate+Eclipse you can generate POJO classes that represent the tables. You can then wire it all together pretty easily with Spring. However, if you have to interact with stored procedures you have to wrap each one in it's own class(es) -- although this is definitely preferred to standard JDBC it is still a bit cumbersome at times.

Does anyone out there know of a script, application, Eclipse Plug-in or anything that generates Spring stored procedure classes?

Thanks in advance.

+2  A: 

You can subclass Spring's StoredProcedure to call stored procs, but there's another way if you're using Spring 2.5. The SimpleJdbcCall class makes this easy.

I don't know about Eclipse plug-ins or anything else to do it for you. If you have a lot of them to do at once, it seems to me to be a perfect spot for a Velocity template, a flat file with the names and I/O parameters for each one, and a quick Java app to marry them together.

[rant] Geez, you've got the framework. Is it too much to ask that we write a little code? If it's all wizards and plug-ins, what's a developer for? [/rant]

duffymo
@your_rant *NO* I don't mind writing code THAT'S WHY I'M A DEVELOPER! What I don't like it writing MINDLESS and REPETITIVE code.
javamonkey79
Voted up for Velocity -- thanks that may or may not help in this context, but I can think of other things to use it for.
javamonkey79
We usually subclass the SP class; I don't know how SimpleJdbcCall could make it any better -- care to elaborate?
javamonkey79
The link I supplied to SimpleJdbcCall shows how to do it. I suggest it because I recently had to expose a set of legacy stored procs. I tried both the subclass and SimpleJdbcCall and preferred the latter. Purely subjective.
duffymo