I am writing an application that’s sole purpose in life is to do CRUD operations for maintaining records in database. There are relationships between some of the tables/entities. Most examples I’ve seen for creating session beans deals with complex business logic/operations that interact with many entities which I don’t have.
Since my application is so very basic, what would be the best design for the session bean(s)?
I was thinking of having one session bean per entity which had CRUD the methods defined. Then I thought of combining all of those session beans into a single session bean. And then I found this blog entry which is intriguing, but I must admit I don’t understand all of it (what is a ServiceFacade?).
I’m leaning towards session bean/entity class, but would like to hear more experienced opinions.
Thanks.
Oops, here’s the blog link: http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao
Not sure what blog entry you’re talking about 🙂 But in your particular situation1, I’d probably use a single session bean implementing an interface similar to:
And the bean would be as follow:
See also
1 Most application shouldn’t expose raw CRUD directly to clients but shield CRUD behind services implementing business rules and encapsulating access to Domain Stores (the
EntityManager).