Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Bean + single DAO for multiple tables?  RSS feed

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-
I'm writing a session bean to lookup code sets for our web tier. Currently we have around a dozen of these code sets (models) and they are growing in number. I would really like to use a single DAO to do all the lookups (so I don't have to write a dozen DAOS, DAO impls etc.) but I have not seen this done anywhere. In my experience it has always been one model to one DAO. I really can't see the purpose for multiple DAOs when I will be doing simple lookups only (no creates etc.) I'm thinking of creating an abstract type of DAO which will encompass ALL of my lookup tables.
thank you,
Max Tomlinson
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Martin Fowler's "Patterns of Enterprise Architectures". It has code examples of exactly this (under "Meta-data driven mappings").
Kyle
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kyle-
Unfortunately any web resources for this topic are no longer available so I will have to see if I can scrounge up a copy of the book--but it does tell me that the design approach I want to use is accepted.
thanks,
Max
 
Jes Sie
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try a O/R approach via Session Bean with a open source framework called Hibernate.
THey have strategies to map an object to many tables and vice versa.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!