Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #633
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Kevin Nathan <knathan@project54.com> |
| Newsgroups | comp.lang.java.databases |
| Subject | Re: Local database library |
| Date | Sat, 5 Oct 2013 12:06:59 -0700 |
| Lines | 115 |
| Message-ID | <20131005120659.39a89f3b@efreet.linux> (permalink) |
| References | <20131001135230.66af12f9@efreet.linux> <nospam-29AECA.15371802102013@news.aioe.org> <20131004110242.1be4f5ea@efreet.linux> <d50f8d5a-bf95-4d95-bc93-6a53b0a16522@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net JeuQTo4IMp1cr35Qzs5A0A/IQOx52SgZ4znX5Yl5uEPdXb0pBB |
| Cancel-Lock | sha1:VOB+xpv5IBDqZzJA2UgOp/gnE04= |
| X-Newsreader | Claws Mail 3.9.0 (GTK+ 2.24.18; i586-suse-linux-gnu) |
| X-Face | %/gp4MCQT=`#JS##?-]V9ksid6OSR@(wbF"bK6wSLO$u,%(N@X~bVhAD+\A_[gRhx*T6=fq "N_5H8.v[&;q0iw!s_wuL05B0xg#OYUkbn#@&U_]fL%o==~2sphc?*L+bicO!POJLG#p'N.]J0/p_w Z^(.kOB%Ob914-V>?GI; |
| Xref | csiph.com comp.lang.java.databases:633 |
Show key headers only | View raw
On Fri, 4 Oct 2013 15:56:18 -0700 (PDT)
Lew <lewbloch@gmail.com> wrote:
>Kevin Nathan wrote:
>>>> So, my question is: Does anyone know of a good tutorial on how to
>>>> build a library of routines in Java?
>
>The Java Tutorial.
>http://docs.oracle.com/javase/tutorial/
>
>Read about JAR files.
>
>All a "library of routines" is is a JAR file of classes.
>
Yes, I understand that, but as you mention below, I'm very new at Java.
I've been going through tutorials and have a lot more to go through. I
just really need a better handle on Java, overall.
>Since database access in Java is a rich and extremely large area, and
>you apparently still lack information on how to build any kind of
>project in Java, that is advisable.
>
And reading tutorials is what I am doing, now. I was hoping it would be
mostly modifying the structure of the C++ program into Java, but that
doesn't seem to be the case.
>There are pitfalls galore in writing just "a local library of database
>access routines". Most likely you'll wind up with an overblown and
>unmaintainable mess that people have to shoehorn into their logic with
>more effort than just using JPA or JDBC themselves.
>
The current C++ code has a DAO library, written about thirteen years
ago and based on C code for twenty-some years before that, that I
thought I could mimic. Apparently, I can't.
>I've done a lot of experimentation with different ways of coding
>database access in Java, and the flat-out worst was a comprehensive
>"local library of database access routines".
>
I get your point.
>By far the easiest to code and maintain was a non-monolithic JPA
>approach.
>
>But you really should know at least *something* about writing database
>access before engaging in the overweening presumption of building a
>"library" for others to use.
>
I started reading through some info on JPA, and I would like to get
there, eventually. But we have a data structure that's been tested and
working since the mid-1970's. It started in BASIC, of all things, but
quickly migrated to C and stayed there (mostly under Real/32 DOS) for
about 25 years, which was the form I maintained for its last 6 years.
I was in on the beginning of the transition to Linux and C++ but ended
up moving before it was finished. That was nine years ago and the
decision to use Qt3 is now biting them in the butt. Conversion to Qt4
is a nightmare. So, they decided to move to Java which should help
insulate them from OS changes, a bit. They called me to see if I could
help so they didn't have to train someone in the livestock auction
system, since I already was quite familiar with it. A professional
company gave them an estimate of 5,000 man-hours to convert it from Qt3
to Qt4 -- the original program only took one man 60 days to write,
initially. So the decision was made to just rewrite it in a new
language and UI library.
I have a fully-functioning and tested DAO library written in-house
(originally in C, then moved to C++) and wanted to mimic that in Java
using the SQL currently existing. I thought that would be easy. I was
wrong. I also thought that all I'd really need to do was generate new
screens and use much of the C++ logic, just modifying it for use under
Java. I was wrong, again.
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.
Until that happens, I will have to muddle through with the brute force
methods that a previous programmer used...
--
Kevin Nathan (Arizona, USA)
Linux is not a destination, it's a journey -- enjoy the trip!
Linux 3.7.10-1.16-desktop
11:29am up 16 days 21:42, 14 users, load average: 0.67, 0.66, 0.62
Back to comp.lang.java.databases | Previous | Next — Previous in thread | Next in thread | Find similar
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