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


Groups > comp.lang.java.databases > #639

Re: Local database library

Newsgroups comp.lang.java.databases
Date 2013-10-15 16:41 -0700
References <20131001135230.66af12f9@efreet.linux> <nospam-29AECA.15371802102013@news.aioe.org> <20131004110242.1be4f5ea@efreet.linux> <d50f8d5a-bf95-4d95-bc93-6a53b0a16522@googlegroups.com> <20131005120659.39a89f3b@efreet.linux>
Message-ID <ec4d1b88-d33a-4b76-a0e6-709319845718@googlegroups.com> (permalink)
Subject Re: Local database library
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Kevin Nathan wrote:
> This is *not* something for general use by others. We have about 60
> clients and add maybe one or two a year, some years. It's only for our
> use in-house and will never see the light of day. If they keep me on
> long enough, I will redo the program for JPA, but a quick solution is
> necessary. Once I learn how to convert SQL like this:
> 
> String command =
>           "SELECT "
>         + "SELLERID, HEAD, DESCRIP, "
>         + "ROUND(WEIGHT/HEAD) AS AVG_WGT, "
>         + "WEIGHT, BUYERID, PRICE, BUYERPEN, "
>         + "(SELECT name FROM seller "
>         + "WHERE date=(SELECT MAX(start) FROM sales WHERE sel=1) "
>         + "AND number=trans.sellerid) AS NAME, "
>         + "(SELECT GROUP_CONCAT(tag_num) FROM backtags "
>         + "WHERE trans_id=trans.trans_id and ckin_date=(SELECT
> MAX(start) FROM sales "
>         + "WHERE sel=1) GROUP BY trans_id) AS ALLTAGS "
>         + "FROM trans "
>         + "WHERE TRANS_ID = '" + transNum + "' "
>         + "AND date=(SELECT MAX(start) FROM sales WHERE sel=1)";
> 
> and even more complex queries into JPA, I will start that process.

That would be insane and stupid.

You don't convert queries into JPA; that's utterly backwards. If you have 
a data orientation, you use straight-up JDBC, not JPA.

JPA is for creating persistent *objects*.

It is not for creating queries or data sets.

> Until that happens, I will have to muddle through with the brute force
> methods that a previous programmer used...

It is weird to hear SQL described as "brute force".

JPA is for object orientation. JDBC is for set orientation.

Your queries, if they are reasonably standard SQL, go directly into JDBC 
'Statement' objects. (Use 'PreparedStatement'.)

Bob's your uncle.

-- 
Lew

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


Thread

Local database library Kevin Nathan <knathan@project54.com> - 2013-10-01 13:52 -0700
  Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-01 17:38 -0400
    Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-01 15:41 -0700
      Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-01 20:53 -0400
        Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-02 10:09 -0700
          Re: Local database library Martin Gregorie <martin@address-in-sig.invalid> - 2013-10-02 19:49 +0000
            Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-04 10:48 -0700
              Re: Local database library Martin Gregorie <martin@address-in-sig.invalid> - 2013-10-05 15:43 +0000
                Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-05 11:19 -0700
          Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-02 22:05 -0400
            Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-04 10:57 -0700
              Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-04 22:00 -0400
                Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-05 11:28 -0700
                Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-05 15:15 -0400
                Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-05 12:49 -0700
  Re: Local database library "John B. Matthews" <nospam@nospam.invalid> - 2013-10-02 15:37 -0400
    Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-04 11:02 -0700
      Re: Local database library Lew <lewbloch@gmail.com> - 2013-10-04 15:56 -0700
        Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-05 12:06 -0700
          Re: Local database library Lew <lewbloch@gmail.com> - 2013-10-15 16:41 -0700
            Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-26 12:08 -0700
              Re: Local database library Martin Gregorie <martin@address-in-sig.invalid> - 2013-10-26 21:04 +0000
                Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-26 18:58 -0700
              Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-26 18:39 -0400
                Re: Local database library Kevin Nathan <knathan@project54.com> - 2013-10-26 19:04 -0700
            Re: Local database library Arne Vajhøj <arne@vajhoej.dk> - 2013-10-26 18:33 -0400

csiph-web