• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

business logic on cmp field (Entity bean)

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
App Server: Weblogic 6.1 (CMP2.0)
DB: Oracle 9i
Hi everybody,
I need some clearification on cmp fields. I really appreciate if you can help me on this.
Cmp getXXX and setXXX method can be declared as abstract method. That's what I thgouht. But is this an requirement? For example, suppose a row contains a column called "password", and there is a specific rule, such as at least 8 letter long, or have to include both character and number. abstract method doesn't contain anything that validates the data.
I am design an entity bean, and I need to set valification based on business rule on almost all setXXX getXXX methods. If I want to implement data validation logic on cmp fields, then I have to implement the setXXX getXXX methods by myself and connect to DB directly in ejbStore and ejbLoad methods? If so,it sounds like BMP.
Is it pretty much a requirement for cmp2.0 not to include validation logic? And if I want to, I have to code everything with bmp?
Or there is a way I can set data validation and still get away with coding ejbStore, ejbLoad, or any other methods?
Or you usually do data validation at somewhere else? (client that uses the bean, dd, etc.)

I think it's highly possible that some system just doesn't let anything go into DB due to some business rules. In those situations, what do you do?

Thank you in advance.
Shin Hashitani
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's generally considered cleaner to place the business logic in a Session EJB and not in the Entitiy beans (BMP or CMP).
However, there's nothing actually forbidding it and I do regularly include "business" methods that do bulk data transfers in order to avoid the overhead of individual field set/get operations, which can be especially expensive over RMI.
 
Shin Hashitani
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,
thank you for your posting.
I just moved business logic to Session Beans that use the EJB. That makes a lot of sense, and code is much cleaner.
I will look into more about Value Object approach you mentioned.
Thank you
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic