1. find(int recNo) throws RecordNotFoundException - looks strange for me, since find() is not addressing a particular record, so it can not face with missing record problem. The only situation I can figure out is problems with underlying IO(raf or channel). But I'm not sure if RecordNotFoundException is the correct exception for such situation(since we are not working with concrete record). So question is open - when does find() use RecordNotfoundException?
2. create() method throws DuplicateKeyException, but assignment tells nothing about this exception or any validation that must be performed in create(). Since database format does not support 'key' field inidicator, it is unclear that 'duplicate key' means? Does it include all fields checking, or just particular(but which one?) checking for duplicates?
3. This one is on locking. lock()/unlock() documentation states, that these facilities ensures that only lock owner can update() or delete() record. But on ohter hand update() and delete() documentation say nothing about locking. So there can be two resolutions of this issue: lock() and update(), delete() are completely independent facilities(i.e. update() does not check for lock) and are used by higher(business) level dtabase wrapper; or all of them are related(i.e. update() fails if no lock is held). Seems like many posts refer to the latter case, but the first one is quite reasonable too(in this case database layer is quite simple and allows everything, but business layer takes care of everything). Any comments on this?
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
find(String[] criteria) - this one is not clear with record not found exc.
create(Strning[] data) - with this one is not clear that 'duplicate key' means.
as for locking, I understand and fully agree, that database layer should provide ability to lock record, since business layer will definitely need this functionality(lock + read + update + unlock sequence). The problem is that I'm not sure that locking should be automatically checked in database layer - maybe this should be left for business layer(i.e. database just provides locking functionality, while business class uses lock(), isLocked() etc. to ensure that only locked record will be modified).
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Consider Paul's rocket mass heater. |