• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO design dilemma

 
Philopator Ptolemy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I�m not sure it�s the right topic to post it but I�ll try

I have to create a relatively simple app that manages personnel reviews and has very simple structure already implemented in legacy DB.
Person Review � N:N � Person
Person Review - N:1 � Various Review Choices/enumerations (tech skills, lead skills, etc)

I�m having doubts on implementing DAOs and model objects (I can�t use hibernate or ibatis � company policy)

Once possibility is to have �rich� model something like this:
Class PersonReview {
Person person;
LeadershipSkills leadershipSkills;
TechnicalSkills technicalSkills;
//more objects representing enumerations that are stored in DB
}
Then I would create PersonReviewDAO that would populate this class and all dependent objects from the database. The problem is that I also need to fetch values for those enumerations for JSF UI combo-boxes.
So should I have separate DAOs for them and call them from PersonReviewDAO?

Also, is it a good idea to have a more flat/relational model like this:
Class PersonReview {
Person person;
String leadershipSkillID; //PK of the enumeration item in db
String technicalSkillID;
}
This approach is much simpler and can directly map to UI whereas in �rich� model case I need to translate model object into JSF managed beans by extracting ids from the LeadershipSkills object.

Thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but my solution would be to leave the company, run away far away.

Why can't you use iBatis, Hibernate or some tool that is best designed for data access?

So that leaves you with JDBC, error prone code, resource management hell, Exception catching like crazy. the best I can do for you is to say "Friends don't let friends code straight JDBC code" If a company says that is your only choice, then they are going to fail in their development, costs are going to be too high, and are just way too archaic, and leave you in a dead end job.

So I recommend, if you can at least use basic Spring, to use Spring's JdbcTemplate or better if Java 5 or above SimpleJdbcTemplate.

Good Luck

Mark
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

We like people to BeForthrightWhenCrossPostingToOtherSites:
http://forums.sun.com/thread.jspa?threadID=5330402&messageID=10418463 discusses the same question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic