Data access concepts

From: Fredrik Bertilsson (fredrik_bertilsson_at_passagen.se)
Date: 12/28/03

  • Next message: bigbinc: "one time hit database connection."
    Date: 28 Dec 2003 09:26:28 -0800
    
    

    I have spend some time to investigate the different concepts of
    O/R-mapping, JDO and entity beans (EJB) for accessing relational
    databases in java programming. I may be very conservative, but I can't
    see that these tools reduces the time that have to be spent on doing
    database programming. Of course, when you do SQL coding in the old
    fashion way, you have to spend a lot of time doing simple insert,
    update and select statements. But the other concepts adds extra things
    to do or reduces the power of SQL.

    Most O/R-mapping tools forces you to write both database DML, java
    value objects and mapping descriptors. And mostly it introduces a
    query language that is similar to SQL, but still something else, and a
    accepted standard is missing. Why must java classes and tables be
    mapped? Why can't java classes be generated from the database
    structure?

    JDO has not the concepts of relations (correct me if I am wrong) and
    the query language seem to be very poor. When I look at the JDO API, I
    miss most things that are good with relational databases. And I see
    that I am not the first one to reject JDO.

    It is a well known fact that entity beans (EJB) have a poor
    performance and they don't reduces the time spent on writing SQL
    statements, very much. Your either have to write JDBC calls (BMP) or
    write SQL (or SQL-like) statemenents in descriptor files (CMP).

    What I am missing is a object model on top of JDBC that reduces the
    time you have to spend on simple SQL statements, but still gives you
    the power to write complex queries. Why are there not a well-known API
    that have Table class with the method findByPrimaryKey? This method
    could return a instance of a Record class, with get- and set-methods,
    and a save-method. With this a lot of boring work could be reduced. If
    preferred, subclasses of this Record class could be generated for
    every table, for making type-safe get- and set-methods.

    In addition you should also have a Query class for expressing more
    complex queries. All tools I have seen (except of S.O.D.A) uses
    strings for defining query filters. Why?? It would be very simple to
    make a Query object model for expressing a complex SQL select
    statement.

    Maybe I am the last one that thinks that the databases is an important
    part of an application. And that the relational model is the
    state-of-art concept of modeling data. Why all this talk about
    converting the relational model to a object model. Make a object model
    for accessing the relational model instead!

    I have made a prototype on how a object model on top of the relational
    model could look like (http://butler.sourceforge.net). Take a look if
    you agree with me in the views above.

    /Fredrik Bertilsson


  • Next message: bigbinc: "one time hit database connection."

    Relevant Pages

    • Re: OOP - a question about database access
      ... Object Pascal) +SQL which is a most improved version of VB. ... never a problem in my Delphi apps. ... pretty much the same as you have it in an object model driven app. ... But coding in Java provides sub-optimal performance ...
      (comp.object)
    • Re: ORM or JDBC?
      ... Collections cannot be a) filtered and b) joined without forloops in Java. ... Which is precisely why JPA allows for alternatives. ... Yes, it's an object model on top, but you can still leverage the data model at ... Dropping to JQL, criteria, or SQL is not a solution, because it means stepping outside the OO world to return to a relational view of the world. ...
      (comp.lang.java.programmer)
    • Re: Database programming with Java
      ... > some of db options and Java libraries for creating databases for only ... > 2-10 users in a LAN environment? ... I generally put the SQL in the classes which perform the tasks. ... The differences between databases is more than just ...
      (comp.lang.java.programmer)
    • Re: dynamically created SQL - batch execution?
      ... which in many databases is only allowed within ... We have adapted our use of SQL so that both ... If the Java application you're talking about produces the SQL in a logical ... you might use another approach than to split the string. ...
      (comp.lang.java.databases)
    • QUESTION: ODBC
      ... I am currently learning Java (yes I know, it was about time to get ... The book I use shows SQL examples reading some small databases ... work only on JDBC-ODBC compliant databases. ... databases files? ...
      (comp.lang.java.databases)