Results 1 to 3 of 3
  1. #1
    Anveshan is offline Member
    Join Date
    May 2011
    Posts
    24
    Rep Power
    0

    Default Encapsulation in jdbc

    Hi

    I will be highly thankful if any one can explain me the following.

    I have read in one of the websites that " the (pros and)cons of JDBC is there is no encapsulation". there is no further explanation of this statement in that site.
    Is encapsulation not implemented for JDBC ? If so, how can we implement it.

    Thanks
    Anveshan

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default Re: Encapsulation in jdbc

    Not sure what they're getting at as the whole (pretty much) of JDBC is defined via interfaces, which makes them as encapsulated as a low level framework can be (IMO).
    It doesn't hide connections or statements or resultsets because that is not the level it operates at, but it does hide the implementation of those things, including how the data is stored, which is a key part of encapsulation.

    Without knowing the context of the statement it would be hard to do more than guess at their intention. You can add encapsulation simply by constructing a data layer into which you pass your model objects, and out of which you get model objects back, never exposing the underlying persistence mechanism used. But that's just good practice anyway, whether it was raw JDBC or Hibernate or some other framework.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Anveshan is offline Member
    Join Date
    May 2011
    Posts
    24
    Rep Power
    0

    Default Re: Encapsulation in jdbc

    Thanks Tolls for your reply. I have got some clarification on this.

Similar Threads

  1. Question about encapsulation
    By kprime in forum New To Java
    Replies: 3
    Last Post: 02-18-2013, 07:25 PM
  2. Confused about encapsulation
    By 007 in forum New To Java
    Replies: 9
    Last Post: 06-23-2011, 12:33 PM
  3. A question about encapsulation
    By 3awash in forum New To Java
    Replies: 4
    Last Post: 04-20-2011, 01:16 PM
  4. encapsulation & constructors
    By buckskinner1776 in forum New To Java
    Replies: 4
    Last Post: 05-10-2010, 07:35 PM
  5. java-Encapsulation
    By lenah in forum Advanced Java
    Replies: 5
    Last Post: 01-05-2009, 10:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •