My suggestion is to start your design by creating java class that describe what you are
trying to model. The database only stores the state of your model. You can use simple
test classes to populate your model and that will probably provide you with necessary
insight as to when/how to access your database. Hope this helps.
Mike
-----Original Message-----
From: gareth davis [mailto:gareth@stripped]
Sent: Wednesday, January 08, 2003 8:19 AM
To: Carlos Proal
Cc: java@stripped
Subject: Re: Style/Design question
Have a look at TableGen, it sorts this out for you.
I've been using a version of it for the last couple of months. It
doesn't have any really advanced features but it works and is easy to
use. If you need all sorts of complex stuff such as transactions,
relationships and stuff, it's time to go get a copy of jboss.
http://freespace.virgin.net/joe.carter/TableGen/
Hope this helps.
Gareth
Carlos Proal wrote:
>
> Hi Mark et all
>
> Im figuring out if someone can advise me about which is the best way
> to create classes that interact with a database.
> For example:
> Currently I have a table "user" which contains username, password,
> name, phone etc
>
> and i have 2 java classes User and DB_User, the first one having only
> the attributes related to user (most of them are taken from table
> definition), and the second one receives a User object in the
> constructor and "fills" information in that User, information of
> course retrieved from the db, ex. "getPhone()".
>
> so i dont know if this is the best way to programm these cases or if
> its better to have only a class User that works as a normal object and
> also interacts with a database when neccesary or something like that.
>
> Thanx a lot, and any advise is really appreciated
> Carlos
>
>
>
>
> _________________________________________________________________
> Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/doc/ (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <java-thread4846@stripped>
> To unsubscribe, e-mail
> <java-unsubscribe-gareth=bigyellowfish.net@stripped>
>
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/doc/ (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <java-thread4861@stripped>
To unsubscribe, e-mail
<java-unsubscribe-mikemarkovich=amyskitchen.net@stripped>