pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JAVA Mapping
2+ messages / 2 participants
[nested] [flat]

* JAVA Mapping
@ 1998-03-23 14:13  anil <anil@server.awcoldstream.com>
  0 siblings, 1 reply; 2+ messages in thread

From: anil @ 1998-03-23 14:13 UTC (permalink / raw)
  To: pgsql-interfaces

HI!
This may be a more like a Java question.
I wanted to map postgresql DB to Java.
The way  I am doing...

class - customer : this is base class.

class - customerList extends customer has methods
public customer fromResultset(Resultset RS) - given the Resultset this
will return customer class instance
public static customerinsert1(String fielsName String content) handle
resultset from deifferent operations
public customerinset2(String fieldName int content)
I do insert field by field - when client press tab from Textbox it
inserts or updates the the DB field if content of field changed.
etc..  for delete and update

class DBConnection  - methods - perform real queries and updates and
inserts etc.
opendir() - open connection to DB
closedir() -close connection
pquery() - perform query on db

class mywindow - has GUI
then this class will take customer instance and fill the fields
cna pass textfield vlaues to the instace of customer class

any other better way to do this??  I am sure ... yes!!!
Tks for any advice on this matter.

Anil




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [INTERFACES] JAVA Mapping
@ 1998-03-23 18:58  Peter T Mount <pgint@maidast.demon.co.uk>
  parent: anil <anil@server.awcoldstream.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter T Mount @ 1998-03-23 18:58 UTC (permalink / raw)
  To: anil <anil@server.awcoldstream.com>; +Cc: pgsql-interfaces

On Mon, 23 Mar 1998, anil wrote:

> HI!
> This may be a more like a Java question.
> I wanted to map postgresql DB to Java.
> The way  I am doing...
> 
> class - customer : this is base class.
> 
> class - customerList extends customer has methods
> public customer fromResultset(Resultset RS) - given the Resultset this
> will return customer class instance
> public static customerinsert1(String fielsName String content) handle
> resultset from deifferent operations
> public customerinset2(String fieldName int content)
> I do insert field by field - when client press tab from Textbox it
> inserts or updates the the DB field if content of field changed.
> etc..  for delete and update
> 
> class DBConnection  - methods - perform real queries and updates and
> inserts etc.
> opendir() - open connection to DB
> closedir() -close connection
> pquery() - perform query on db
> 
> class mywindow - has GUI
> then this class will take customer instance and fill the fields
> cna pass textfield vlaues to the instace of customer class
> 
> any other better way to do this??  I am sure ... yes!!!
> Tks for any advice on this matter.

Several of the JDBC books out there do a similar approach.

They usualy go along the lines:

class DBConnection	- as you, connects & handles queries
interface SqlFactory	- a set of methods called by DBConnection when
			  handling updates & inserts

As part of the jdbc driver's docs, I've got two tutorials planned around
this theme (one using standard JDBC, the other postgresql specific), but
my current workload means this is going to be at least a couple of weeks
before I get to start on them.

PS: The postgresql specific one is along the lines of how to map postgres
classes and java classes...

Peter

-- 
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1998-03-23 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-03-23 14:13 JAVA Mapping anil <anil@server.awcoldstream.com>
1998-03-23 18:58 ` Peter T Mount <pgint@maidast.demon.co.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox