aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Making my data aceesing class reusable. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Making my data aceesing class reusable." Watch "Making my data aceesing class reusable." New topic
Author

Making my data aceesing class reusable.

Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

Here is my final approach unless I am advised against it.

I construct my my accessor calling upon 2 private methods inside a try block. The first method is validateDatabase(RandomAccessFile); I would then like this method to call on a helper class that validates the schema information. This SchemaReader class validates the schema with all the expected values that I hardcoded in my Data representation class of a Contractor. The theory here is that each time the database changes if my class is to be reused then logically the schema would differ. Logically my choice of hardcoding values that are expected can be put in the Contractor class as this class is directly tied to the database anyway. Each time the database changes the DTO and the schema would need to change.

After validation I instantiate my List of records.

Does this make sense?


SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
http://www.youtube.com/user/thejartender?feature=mhee
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Making my data aceesing class reusable.