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>
>
>