Hi,
I'm new to EJB3, and would like to ask a design question:
Is it customary to add a 'Data Access' layer between the Session beans and the Entities?
Or would your Session bean simply access the Entity API directly?
For example, say I have a 'Bank' session bean, and Account entities.
Then Bank can directly access the Entity API:
But I'm considering an alternative of writing a Data Access layer, something like the following.
It seems more work, but the session bean becomes more readable (especially if it has some additional complex logic and not just simple 'find'), and it can hide some sql implementation choices (e.g. if we find some way to optimize the query, or move to native sql, etc):
Of course this is a simplified example... in real life, the code may be more complex (especially the Session logic), and a query may be re-used from several methods.
If anyone can share their views, and/or refer me to EBJ design tutorials, it will be appreciated.
Thanks
[ September 24, 2007: Message edited by: Sol Ma-Orn ]