Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

A design in practise

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic