3 Replies - 789 Views - Last Post: 11 October 2008 - 03:57 AM Rate Topic: -----

#1 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 562
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Java project advise needed please

Posted 10 October 2008 - 01:39 PM

As extra for my coursework, we can do some additional features. I just wanted some advice on how these are implemented and if they are difficult to do. The extras include:
More sophisticated UI, e.g., multiple concurrent client users.
Distributed client-server architecture (could use RMI)

I am more interested in the first one. If i create a JDBC application, how would i handle this?
Any help appreciated.
cheers

Is This A Good Question/Topic? 0
  • +

Replies To: Java project advise needed please

#2 JeroenFM  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 195
  • Joined: 30-June 08

Re: Java project advise needed please

Posted 10 October 2008 - 02:01 PM

View Postnick2price, on 10 Oct, 2008 - 01:39 PM, said:

As extra for my coursework, we can do some additional features. I just wanted some advice on how these are implemented and if they are difficult to do. The extras include:
More sophisticated UI, e.g., multiple concurrent client users.
Distributed client-server architecture (could use RMI)

I am more interested in the first one. If i create a JDBC application, how would i handle this?
Any help appreciated.
cheers


Multiple concurrent clients can be done in a number of ways. If you just want to have the ability to have multiple windows operate on the same data then a simple Model-View-Controller pattern will do, with multiple views listening to changes in the same model.

Depending on the function of your application, you could make it web-based (JSP, Servlets or something more complicated such as Struts).

If you make a JDBC application just make sure none of the JDBC stuff ends up in the view, and you use transactions whenever possible (SQL: BEGIN TRANSACTION followed by either COMMIT or ROLLBACK).
Was This Post Helpful? 0
  • +
  • -

#3 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 562
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Java project advise needed please

Posted 10 October 2008 - 02:10 PM

My classes are completely in a three tiered structure, so i have data, busines and logic seperated, so my gui only contains gui code and any actions are referenced from its appropiate methods class. For my JDBC quiries, i'm not sure what you mean but transactions, but i rollback the connection on any errors and i commit the connection after every query. Does this mean my program would handle concurrent client users as it stands? Or does it need additional code?
Was This Post Helpful? 0
  • +
  • -

#4 JeroenFM  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 18
  • View blog
  • Posts: 195
  • Joined: 30-June 08

Re: Java project advise needed please

Posted 11 October 2008 - 03:57 AM

View Postnick2price, on 10 Oct, 2008 - 02:10 PM, said:

My classes are completely in a three tiered structure, so i have data, busines and logic seperated, so my gui only contains gui code and any actions are referenced from its appropiate methods class.


Excellent!

Quote

For my JDBC quiries, i'm not sure what you mean but transactions, but i rollback the connection on any errors and i commit the connection after every query. Does this mean my program would handle concurrent client users as it stands? Or does it need additional code?


Well transactions are basically SQL constructs to ensure consistency, basically what you say is:

BEGIN TRANSACTION

UPDATE statements;

SELECT statements;

UPDATE statements;

COMMIT/ROLLBACK;



Any changes within the transaction are invisible to the rest of the database until they're committed, but the changes will be visible within the transaction. The only extra step you need to make to properly use transactions is to explicitly begin them.

In many cases this should be sufficient for ensuring consistency between clients, but just to be sure, take a look at transaction isolation. Another thing to keep in mind is that if your database is mapped to model objects, those objects may become out of date.

This post has been edited by JeroenFM: 11 October 2008 - 03:58 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1