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


Groups > comp.lang.java.help > #951

Re: Doing JDBC code in a less unwieldy way?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.help
Subject Re: Doing JDBC code in a less unwieldy way?
Date Thu, 18 Aug 2011 08:57:06 -0700
Organization A noiseless patient Spider
Lines 31
Message-ID <j2jcos$i4n$1@dont-email.me> (permalink)
References <j2javb$4pq$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 18 Aug 2011 15:57:16 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="18583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JepFCfm0O4Z63asvpZfwTwfikSOhqU7g="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
In-Reply-To <j2javb$4pq$1@dont-email.me>
Cancel-Lock sha1:zPWvqDrcE9CjofldK2UFnu01Df8=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.help:951

Show key headers only | View raw


On 8/18/2011 8:26 AM, Steve wrote:
> The place where I work isn't ready to go to a framework and something
> like a hibernate yet.


Why not?  I think this would be the best solution.  You don't have to 
use a full enterprise suite, these frameworks function in isolation too.

I admit I haven't used Hibernate solo in a web app, but I understand 
it's not hard to do.


>
> Is there a design pattern for voluminous update and insert statements or
> articles about how to handle these things in a less unwieldy way.


If you really can't use Hibernate (and I'd push as hard as I could for 
it), then I think perhaps some sort of reflection would work.  You'll 
end up duplicating a fair chunk of Hibernate/JPA though.

Example, for any given class with some getters and setters:

1. Get the mapping for the table for that class.
2. Get the mapping for the fields for that class.
3. Read/Write the fields reflectively into rows.

You can either use annotations for the mapping, like modern JPA does, or 
you can use some big ol' config file, like the older Hibernate/JPA 
stuff.  Either way, you're reinventing the wheel.

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


Thread

Doing JDBC code in a less unwieldy way? Steve <tinker123@gmail.com> - 2011-08-18 11:26 -0400
  Re: Doing JDBC code in a less unwieldy way? markspace <-@.> - 2011-08-18 08:57 -0700
    Re: Doing JDBC code in a less unwieldy way? Lew <lewbloch@gmail.com> - 2011-08-18 11:26 -0700
  Re: Doing JDBC code in a less unwieldy way? Roedy Green <see_website@mindprod.com.invalid> - 2011-08-19 02:00 -0700
    Re: Doing JDBC code in a less unwieldy way? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-19 08:59 -0300
      Re: Doing JDBC code in a less unwieldy way? Lew <lewbloch@gmail.com> - 2011-08-19 07:57 -0700
      Re: Doing JDBC code in a less unwieldy way? Steve <tinker123@gmail.com> - 2011-08-19 19:50 -0400
        Re: Doing JDBC code in a less unwieldy way? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-19 21:26 -0300
          Re: Doing JDBC code in a less unwieldy way? Lew <lewbloch@gmail.com> - 2011-08-19 20:20 -0700
      Re: Doing JDBC code in a less unwieldy way? Roedy Green <see_website@mindprod.com.invalid> - 2011-08-20 17:19 -0700
        Re: Doing JDBC code in a less unwieldy way? Lew <lewbloch@gmail.com> - 2011-08-20 18:53 -0700
        Re: Doing JDBC code in a less unwieldy way? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-21 10:32 -0300
  Re: Doing JDBC code in a less unwieldy way? Ricardo Palomares Martínez <rpm.PUBLI@iespana.es> - 2011-08-20 13:07 +0200
    Re: Doing JDBC code in a less unwieldy way? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-20 10:59 -0300
      Re: Doing JDBC code in a less unwieldy way? Lew <lewbloch@gmail.com> - 2011-08-20 10:02 -0700
        Re: Doing JDBC code in a less unwieldy way? Ricardo Palomares Martínez <rpm.PUBLI@iespana.es> - 2011-08-21 16:03 +0200
      Re: Doing JDBC code in a less unwieldy way? Ricardo Palomares Martínez <rpm.PUBLI@iespana.es> - 2011-08-21 15:54 +0200
        Re: Doing JDBC code in a less unwieldy way? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-22 18:56 -0300

csiph-web