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


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

Re: Spring/hibernate and JDBC

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: Spring/hibernate and JDBC
References <3c16e5e7-3c0b-4126-9dd9-88f372a58f03@e26g2000prf.googlegroups.com> <ivamk9$dph$1@dont-email.me> <alpine.DEB.2.00.1107101321480.23764@urchin.earth.li> <8niSp.53327$SG4.34636@newsfe03.iad> <ivcdur$g4a$1@dont-email.me>
Message-ID <R2oSp.53524$SG4.49215@newsfe03.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2011-07-10 17:35 -0300

Show all headers | View raw


On 11-07-10 11:45 AM, Stanimir Stamenkov wrote:
> Sun, 10 Jul 2011 11:08:01 -0300, /Arved Sandstrom/:
>> On 11-07-10 09:34 AM, Tom Anderson wrote:
>>
>>> This has also been my impression. On my current project, we do still
>>> write raw SQL using JDBC on occasion, but only because we need to do
>>> some sort of mad query that can't be done with our persistence provider.
>>> For instance, we have a query that runs every hour to update our list of
>>> top-selling products, which joins together all sorts of tables and
>>> inserts the result directly into a table. I don't think there's any way
>>> to do that (up to and including inserting from the select) with JPA.
>>
>> Short of using features that are peculiar to an implementation, it seems
>> to me that if you had that result table described as a JPA entity, you
>> could use an EJBQL constructor expression to load up the to-be-inserted
>> entities from that mess of joins. Persist _those_.
> 
> I was just about to ask whether one have used such Constructor
> Expressions in real life:
> 
> http://download.oracle.com/javaee/5/tutorial/doc/bnbuf.html#bnbwc
> http://download.oracle.com/javaee/6/tutorial/doc/bnbuf.html#bnbwc
> 
I have used them fairly frequently to prepare presentation models in
JSF, to use Martin Fowler's terminology. This is related also to view
models in Microsoft WPF.

To give an example, if a JSF dataTable has numerous columns, and quite a
few of them are fields of _many_ entities that are all retrieved by a
complex query with joins, it can be quite convenient to use a JPQL ctor
expression to load up a List of presentation model class instances. This
is more concise, and it more clearly keeps a division between
persistence and view backing data.

HTH,
AHS

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


Thread

Spring/hibernate and JDBC Jack <junw2000@gmail.com> - 2011-07-09 14:56 -0700
  Re: Spring/hibernate and JDBC markspace <-@.> - 2011-07-09 16:01 -0700
    Re: Spring/hibernate and JDBC Jack <junw2000@gmail.com> - 2011-07-09 17:29 -0700
      Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 17:55 -0400
    Re: Spring/hibernate and JDBC Jack <junw2000@gmail.com> - 2011-07-09 17:32 -0700
      Re: Spring/hibernate and JDBC Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-10 08:27 -0300
      Re: Spring/hibernate and JDBC Aéris <aeris@imirhil.fr> - 2011-07-10 13:33 +0200
      Re: Spring/hibernate and JDBC lewbloch <lewbloch@gmail.com> - 2011-07-11 11:25 -0700
        Re: Spring/hibernate and JDBC Aéris <aeris@imirhil.fr> - 2011-07-11 20:44 +0200
        Re: Spring/hibernate and JDBC Jack <junw2000@gmail.com> - 2011-07-11 16:39 -0700
          Re: Spring/hibernate and JDBC lewbloch <lewbloch@gmail.com> - 2011-07-11 17:06 -0700
            Re: Spring/hibernate and JDBC Gene Wirchenko <genew@ocis.net> - 2011-07-11 21:37 -0700
          Re: Spring/hibernate and JDBC Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-12 07:01 -0300
          Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 18:00 -0400
        Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 17:58 -0400
          Re: Spring/hibernate and JDBC Tom Anderson <twic@urchin.earth.li> - 2011-07-22 17:24 +0100
      Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 17:52 -0400
    Re: Spring/hibernate and JDBC Tom Anderson <twic@urchin.earth.li> - 2011-07-10 13:34 +0100
      Re: Spring/hibernate and JDBC Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-10 11:08 -0300
        Re: Spring/hibernate and JDBC Stanimir Stamenkov <s7an10@netscape.net> - 2011-07-10 17:45 +0300
          Re: Spring/hibernate and JDBC Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-10 17:35 -0300
      Re: Spring/hibernate and JDBC Steve Sobol <sjsobol@JustThe.net> - 2011-07-10 09:42 -0700
    Re: Spring/hibernate and JDBC Tom <tom400f@gmail.com> - 2011-07-10 22:29 +0000
    Re: Spring/hibernate and JDBC Gunter Herrmann <notformail0106@earthlink.net> - 2011-07-11 10:19 -0400
      Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 18:09 -0400
  Re: Spring/hibernate and JDBC Aéris <aeris@imirhil.fr> - 2011-07-10 13:24 +0200
    Re: Spring/hibernate and JDBC Elegie <elegie@anonymous.invalid> - 2011-07-10 13:56 +0200
      Re: Spring/hibernate and JDBC Aéris <aeris@imirhil.fr> - 2011-07-10 14:17 +0200
  Re: Spring/hibernate and JDBC Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-10 10:44 -0300
  Re: Spring/hibernate and JDBC Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-07-11 09:52 +0300
  Re: Spring/hibernate and JDBC lewbloch <lewbloch@gmail.com> - 2011-07-11 11:31 -0700
    Re: Derby and Java SE (was: Spring/hibernate and JDBC) lewbloch <lewbloch@gmail.com> - 2011-07-11 15:46 -0700
  Re: Spring/hibernate and JDBC iadb <freeinternetarticles@gmail.com> - 2011-07-17 10:17 -0700
  Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 17:47 -0400
  Re: Spring/hibernate and JDBC Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 18:02 -0400

csiph-web