Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should we store the msg about passenger ?

 
Ray Cheeny
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I have some questions
If the user click the booking button,what should I do then?Record the user name,seats or something else? Where should I put these the user's records?Store these in the db.db,right?But there is not a passenger field.
thanks
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ray,
You don't need to worry about any of that. All you should be concerned with is the integrity of the database, ie that all seats are accounted for and the db stays in a consistent state.
Hope this helps,
Michael Morris
 
Ray Cheeny
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean that when the user click the booking button ,i just reduce the number of available seats
and that's enough ,right?
But,then what is the method addRecord()'s function,
for the user should not operate this .Who need use it?
 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is all you need to do... and make sure that it works when multiple clients are booking at the same time (that's where lock/unlock comes in).
Add record is probably there because it is a normal db function, or it was used way back when Sun made the developer create the database from a text file, or they just want to confuse you Anyway, you shouldn't need to use the addRecord() method.... I have never seen anyone use it.
 
Ray Cheeny
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I've seen a lot about Connection factory and factory object.But I still couldn't understand it.Could somebody explain it or tell me how it works?
thanks
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ray,
A ConnectionFactory uses a Factory pattern to issue each connecting client a unique connection. It should have a mehtod named getConnection or something similar which returns an implementation of your remote Data interface. It must itself implement Remote (thru an interface that contains the getConnection method and extends Remote) and should extend either UnicastRemoteObject or Activatable and should be bound to the RMI registry with a service name like "DBConnectionService". Your clients will connect to this service thru Naming and call getConnection to get your remote Data interface.
The remote implementations will not be bound to the RMI registry.
If you don't use a factory and just bind a remote Data implementation to the registry, you create a bottleneck since all clients will have to share the same object for database operations.
Hope this helps,
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic