Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

MSSQL Stored Procedures to Java objects

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I don't know if the question should be posted here but since am gonna use Java objects as my end-result, what the heck. I'd like to know if there's a migration tool for converting MSSQL stored procedures to POJOs.

Many thanks!
 
Ranch Hand
Posts: 214
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think there is a tool to convert stored procs to POJOs, but you can use Hibernate to create POJOs from your database tables. This is not something to just automatically do though, because database design and object design are different beasts.

I'm guessing your stored procs perform basic CRUD operations?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stored procedures do not correspond so much with objects in the Java world, but with methods. Maybe you can give us more detail about where you're starting, and where you'd like to end up.
 
Patty Domingo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes with business logics included in the stored procs.

The reason behind converting stored procedures to POJOs is that currently, the bulk of the business logic of our application is in the stored procs. We want to take out the business logic from the stored procs and convert it as POJOs. As much as possible, only CRUD operations are being done on the database server side.

Originally posted by Edwin Keeton:
I'm guessing your stored procs perform basic CRUD operations?

 
Edwin Keeton
Ranch Hand
Posts: 214
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If there's business logic in your stored procedures you're neither going to find nor be able to build an automatic migration tool.

As Ulf pointed out, stored procs do not correspond well with objects. They do not even correspond very well with object methods, since they are procedural rather than object-oriented.

Depending on the complexity of the stored procedures, this can be a very difficult migration process. More than once I've seen the migration attempt abandoned out of frustration in favor of a total rewrite from scratch.

I would strong recommend a test-driven development process, a stored proc at a time, writing tests to cover all the business logic in that proc. Then wrting the code to make those tests pass, etc.

Hopefully your existing stored procs aren't overly complex. Good luck.
 
Patty Domingo
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We really have loads of stored procedures that have business logics built into it. Our main concern here is time. Of course, it's a matter of deciding whether to do it the faster way but would end up doing the complex way or really doing it another way resulting to a more productive task.

Many thanks for your help and input, Ulf/Edwin! I really appreciate your replies =)

Thank you for your time!
[ April 11, 2006: Message edited by: Patty Domingo ]
reply
    Bookmark Topic Watch Topic
  • New Topic