Master Data - Are they EJB's ?
Hi,
In my application, I have an "Account" Entity that holds the account data. There is also a field called "account status", which comes from "parameter" table.
The account table stores the PK of parameter table.
Now Do I make this parameters table an entity EJB as it is not a business entity as such?
If I don't how do I write code for Account EJB
regards
Hi,
Sorry I couldn't understand...may be I will try to re-explain.
Question is:
Is it good to create a separate bean (entity) for parameters or I can use joins in my account EJB to fetch the required data.
As parameters is not a business entity so maybe I don't create it as entity bean. I can use joins and get the required data.
On the other hand, if I use joins in account, I am kind of directly accessing the other table apart from account. That is not a good practice while creating EJB's...
Am confused...what to do....
Pls help
If you use CMP, then you must make Parameter another Entity Bean. With CMP, practically each entity bean maps to a table and each table must be mapped to at least one entity bean. Because that's the only way CMP can read/write your tables.
If you use BMP, then you do not need to make Parameter a separate EJB. You can put any JDBC code in your Account bean to read Parameter table anyway you want.
yilin at 2007-6-29 17:32:17 >

Although EJB spec may have recommanded make Entity Beans only for business objects (and use dependent value object for other objects), in reality with CMP, as people started using CMP in real world, it has been realized in the industry that it's just wishful thinking unless you use BMP. In you case, making parameter a dependent value object seems to make more sense, but how is CMP going to read it from DB? So the new local interface in EJB2.0 basically acknowledged the dilema and provided a solution - so in EJB2.0, you can make Parameter still another entity bean, but with a local (instead of remote) interface.
yilin at 2007-6-29 17:32:17 >
