Design of Entity Bean with "Dynamic Fields"?


EJB design: Design of Entity Bean with "Dynamic Fields"?

  1. Design of Entity Bean with "Dynamic Fields"? (1 messages)


    I have a question regarding the design of a new system I'm about to start developing. It's really a small thing, but I'm not a very experienced EJB developer so I find some things rather tricky.

    The system is supposed to keep track of projects for a small construction company. Let each project be an entity bean containing information such as project id, project name etc. What I want to do is to let the customer (the construction company) decide what fields to use on projects in the system. Say, they say want a field for fax number and another field for e-mail. Then in the end, some other company could be using this same system but choose to have other fields on their projects.

    Any good ideas on how to do this? It's probably a common problem, are there any design patterns for this?

    My idea so far is to use a BMP entity bean which reads some XML file or something with information of what database fields to use. This bean will then expose a method like String getField(String fieldName) or something. Haven't tried it though, as I've only used CMP entity beans.

    Thanks alot for any guidance.

    (and please excuse me for my poor English!)
  2. Is the database structure going to remain the same? Or is it different for each customer? Does each customer who uses this system get a new set of ejbs (build as per their requirement?)
    If so, then all that needs to change is the deployment descriptors for the entity ejb. If all this information is stored in a central database and each field has a different meaning (depending on the customer), then I really dont know whether u want to use EJBs at all.... u might be better off doing straight jdbc from a session bean and handle all the logic urself... my thoughts with my limited experience...