Re: ORM or JDBC?
On 25-03-2011 08:00, Michal Kleczek wrote:
Lew wrote:
Michal Kleczek wrote:
I think we start to talk past each other but let me try again.
Swing _is_ a DOMAIN model - it models a domain of GUI.
Nicely disingenuous argument there.
I need to "map" two DOMAIN models - accounting database schema and Swing.
Is JPA going to help me with that. If so - may I ask for some
tutorials/articles/examples?
The GUI is not the domain model unless the GUI is the domain your program
models. If you don't understand that then nothing else we can say will
make sense.
If your program models a general ledger, for example, then the GUI is not
the
domain model.
My program does not _model_ anything. It fulfils requirements.
Modeling your domain is a key concept in OOD/OOP.
If you are not using OOD/OOP, then you wil not ant ORM.
I am also skeptical about whether Java is the right choice of language.
How can you even make a statement or have a thought that it
is?
That is exactly my point. My program is supposed to provide a GUI so that a
user can enter/modify data in a particular accounting database managed by a
RDBMS. So it's domain is _not_ accounting but user interface and
communication with RDBMS. There is no single line of code related to
accounting in it (and there should not be because this is not the purpose of
this program).
Part of classes in my program is related to UI because this is what this
program is supposed to do. Another part of my program is made of classes
that are related to communicating with RDBMS - again - because that is what
my program is supposed to do.
The fact those classes are off the shelf (both JDBC and Swing) is not
relevant.
You are operating on data for accounting.
You should use an accounting domain model.
It would help the structure of your code.
But more importantly: you should go through a business
logic layer that implements accounting rules.
Directly editing data in an accounting database without
going through accounting business logic comes with a risk
of bring the data in an inconsistent state.
And it is also illegal in many jurisdictions.
Once you understand what a domain model is we can proceed.
I am more and more convinced it is not me who does not understand what
domain and domain model is :)
You have beyond any doubt proved that you don't know what a domain model
(or that you use a definition that is different from what everybody
else uses, which in reality is the same).
Arne