Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26086

Re: The easiest framework for Java Database applications development released for production use

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: The easiest framework for Java Database applications development released for production use
Date 2011-02-07 07:25 -0500
Organization albasani.net
Message-ID <iioobf$h14$1@news.albasani.net> (permalink)
References <740c95bd-a21f-4ad3-8733-6b3b61e44e18@l18g2000yqm.googlegroups.com> <MPG.27b8fec562e57f9e9897c8@news.justthe.net> <iinp9v$765$1@news.albasani.net> <92e64642-b624-4598-beaa-c57540a30733@k22g2000yqh.googlegroups.com>

Show all headers | View raw


yaormaAdmin wrote:
> Thanks for the feedback. The special bit in the code shown on the
> front page is in the Database.getData(sqlString, conn) call.
> Basically it encapsulates the boilerplate code that opens the cursor
> on the database side (e.g by creating a Statement and a ResultSet).
> Often in large projects someone, somewhere, inevitably forgets to

Fire that person.  There's nothing "inevitable" about such a rookie mistake.

> close the Statement and/or the Resultset in a finally block where an

<http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#close()>
"Note: When a Statement object is closed, its current ResultSet object, if one 
exists, is also closed."

> exception is thrown.  This results in a cursor being left open in the
> database.  Eventually the code is executed enough times to exhaust the
> maximum number of cursors allowed for the connection.  The next call
> that opens a cursor in the database fails.  This is often not the
> offending code but some perfectly good code that exists in some other
> far off place in the code.

How "often" does that happen?  What statistical basis do you have for such a 
claim?  Where is your evidence?

> Since yaorma encapsulates all of this boilerplate code (i.e. the
> allocation and deallocation of the Statement and Resultset objects and
> the opening and closing of the database cursors) this type of error is
> prevented.  Also, its easier to get the data in the single
> Database.getData(sqlString, conn) call than to write the boilerplate

And what if you aren't ready to deallocate the Statement?

> code to create the statement, create the result set, iterate through
> the result set, marshal the data into some type of data object, close
> the result set in a finally block, close the statement in a finally
> block, etc.

You make it sound much harder than it really is.  Remember, closing the 
'Staztement' also closes the 'ResultSet'?  Of course, being a helpful API 
write, surely you knew that already.  If you didn't, how could we trust your 
API given that level of ignorance?

Marshaling the data is not boilerplate.  It depends on the particular data to 
marshal, i.e., the structures of the tables and entities.  Iteration is all of 
one expressions, rs.next(), in a loop condition.

The 'try' ... 'finally' is embedded into the subconscious of every competent 
Java programmer.  Taking away control of that from the programmer is not 
usually a good thing.

> The pages in the more details link (http://www.yaormama.orĝ/pages/
> details.html) at the bottom of the homepage go into some of this stuff
> as well as some of the other functionality including parametrized
> queries, the generation and use of data value objects, marshaling data
> from web pages, and marshaling data from the database in constant
> space (e.g. for large data sets) etc.

How well does this sliced-bread thingie work with JPA?

-- 
Lew
Ceci n'est pas une fenêtre.
.___________.
|###] | [###|
|##/  | *\##|
|#/ * |   \#|
|#----|----#|
||    |  * ||
|o *  |    o|
|_____|_____|
|===========|

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-06 22:35 -0500
  Re: The easiest framework for Java Database applications development released for production use Lew <lew@lewscanon.com> - 2011-02-07 09:57 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 11:19 -0800
  Re: The easiest framework for Java Database applications development released for production use Lew <lew@lewscanon.com> - 2011-02-07 08:10 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 09:32 -0800
  Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 19:29 -0800
    Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 22:33 -0500
  Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-08 19:08 -0500
  Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 18:04 -0500
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 18:59 -0800
      Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-07 19:18 -0800
  Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-09 07:55 -0500
  Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-06 20:30 -0800
    Re: The easiest framework for Java Database applications development released for production use yaormaAdmin <yaorma@gmail.com> - 2011-02-08 05:44 -0800
    Re: The easiest framework for Java Database applications development released for production use Steve Sobol <sjsobol@JustThe.net> - 2011-02-06 21:54 -0800
    Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 18:00 -0500
    Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-07 21:33 -0500
    Re: The easiest framework for Java Database applications development released for production use Arne Vajhøj <arne@vajhoej.dk> - 2011-02-08 19:06 -0500
      Re: The easiest framework for Java Database applications development released for production use Wojtek <nowhere@a.com> - 2011-02-08 21:59 -0800
    Re: The easiest framework for Java Database applications development released for production use Lew <noone@lewscanon.com> - 2011-02-07 07:25 -0500

csiph-web