Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 132,120 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,988 people online right now. Registration is fast and FREE... Join Now!




Java project advise needed please

 
Reply to this topicStart new topic

Java project advise needed please

nick2price
post 10 Oct, 2008 - 12:39 PM
Post #1


D.I.C Head

**
Joined: 23 Nov, 2007
Posts: 231



Thanked 6 times
My Contributions


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
User is offlineProfile CardPM

Go to the top of the page

JeroenFM
post 10 Oct, 2008 - 01:01 PM
Post #2


D.I.C Head

Group Icon
Joined: 30 Jun, 2008
Posts: 182



Thanked 9 times

Dream Kudos: 100
My Contributions


QUOTE(nick2price @ 10 Oct, 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


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).
User is offlineProfile CardPM

Go to the top of the page

nick2price
post 10 Oct, 2008 - 01:10 PM
Post #3


D.I.C Head

**
Joined: 23 Nov, 2007
Posts: 231



Thanked 6 times
My Contributions


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?
User is offlineProfile CardPM

Go to the top of the page

JeroenFM
post 11 Oct, 2008 - 02:57 AM
Post #4


D.I.C Head

Group Icon
Joined: 30 Jun, 2008
Posts: 182



Thanked 9 times

Dream Kudos: 100
My Contributions


QUOTE(nick2price @ 10 Oct, 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.


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:

SQL

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 Oct, 2008 - 02:58 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 10:58AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month