• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Framework for simpler stored procedure access?

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Is there any framework that creates java stubs for stored procedures?
So I point the generator tool to my DB, it scans the stored procedures there and creates java code.

So instead of this:


I could write:


Or even: generatedCode.my_proc_2(20,4,"foo",5).getResult() and it would have the correct type for the returned data.

I tried Spring JDBC and cayenne , but the code needed to type manually is more or less the same as with plain JDBC.

Regards,
David
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not exactly the same, but Javaranch has the Jenny code generator for database code.
 
David Balažic
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jenny does not seem to do anything for stored procedures.
 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Have you looked at the iBatis ?
It may not generate the every part of the code but you can configure the stored procs. in a XML.
If you follow some standard writing all the stored procs. for e.g if you define all of your stored procs. would have one input and one output parameter then you can have a single DAO class interacting with all stored procs adhering to this standard. Whenever you have another procedure to be invoked you just need to add its specification in the XML file.

Regards,
amit
 
David Balažic
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

amit punekar wrote:Hi,
Have you looked at the iBatis ?


Yes.
As we have predefined stored procedures, it does not offer any more that for example cayenne. (which is almost nothing, as the need for handwritten code is almost the same as with plain JDBC).
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The short answer is no, there is not a framework, in part because stored procedures differ greatly among DBMS's. Take your source code, for example, which relies on "OracleTypes" values, something obviously specific for Oracle.

For iBatis, keep in mind the goal is not necessarily to write shorter code but make the code easier to change. For example, with iBatis you can change the name of the stored procedure in XML without recompiling the Java code. Indirection can be a useful, if not immediately obvious, feature.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic