Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A design in practise  RSS feed

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
There is a more interested scenario I must face to:
I have almost 40 tables which I created by phisical reason, right now I just simplified this as 3 tables, A, B and C. Each tables has some columns independent, but others depend on columns in other tables or a result of several columns in other tables. For example, A.column1 is independent, but A.column2 is the value of B.column10, and B.column10 is the sum of C.column25 and C.column26. User maybe sometime want to view one of the tables, and I must make sure the values are updated and accurate.
This scenario descides I must either include the business logical(for example calculate sum of C.column25 and C.column26 or query out entity bean C) into entity bean or its session facade(or business delegate). I have worked out several solutions, but I don't feel be confident, they are:
Put logic into entity bean to query out other entity beans, and then calculate the value of the columns in current entity. In the business logic, I must make sure every request of user viewing entity A, then the logic calculates through the A-B-C chain all the way down.
I think it isn't good, because entity engages other entity's access.
Make entity as dummy, add session bean for each entity consisting of business logic. Session A will access session B to get values in B. The business logic design is same as above.
How about this one?
Make entity as dummy, use CMP relation fueature of EJB2.0. Only one session bean is here, it consists of all of the business logics. The session bean is responsiable for all queries and calculation on all entities(imagine, in my project there are 40 entities should be deal with by this session bean, the performance shouldn't be good). The advantage of this solution is centeralized business logic, container could help to complete some queries using relation fueature.
Which one is better? Or a best one I haven't thought out? Any comments and suggestions are very very welcome!
Anderson gave himself the promotion. So I gave myself this tiny ad:
Why should you try IntelliJ IDEA ?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!