Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Separating SQL Code from CLASS

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Just wondering if any of you have written classes where the SQL code is outside of java class, this is essential because say the schema changes I dont want to go to all the classes where my SQL code is scattered around and make the changes, instead I can go to one class and I am fine. If anyone of you have implemented this approach please share them. if not post your opinions on this approach.
Thanks all for your time.
Samson
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically if you want a flexible data layer you can create a data access layer. If know EJBs than that is an example. You create classes with a bunch of bean properties that know how to write themselves to the database. You application logic doesn't even have to know anything about the database.
 
Samson Annamdevula
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David
Ya I am familiar with Entity Beans and how SQL code is separated from the Bean especially in Bean Managed Persistence. But I am interested in applications where robust EJB implementation is not necessary.
Samson
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic