This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Aug 21, 2002
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?
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.
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
Joined: Jan 30, 2002
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