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?

From markspace <-@.>
Newsgroups comp.lang.java.help
Subject Re: Doing JDBC code in a less unwieldy way?
Date 2011-08-18 08:57 -0700
Organization A noiseless patient Spider
Message-ID <j2jcos$i4n$1@dont-email.me> (permalink)
References <j2javb$4pq$1@dont-email.me>

Show all headers | 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