We have implemented "User Defined Fields" or "Extensible Fields" in my current project. Basically the user can define the metadata about the user defined entity (table) and fields and then data can be added later. This allows us to extend/customize our application (as per customer's requirement) without any code change or a new release.
Currently we have implemented this as BMP in EJB1.1. Of course lazy instatiation is used to optimize the UDF loading. We are planning to move away from BMPs and move towards CMPs in EJB 2.x.
Question is - Is there any better way of implementing this functionality usng EJBs/CMPs?
Does anybody have any idea/opinion on using XML to store the extensible data instead of storing as a separate row in the table?
The user defined data is used mainly to store it and for reporting purpose but what if I have to use it in my business logic? Is this efficient?
It is likely that the same tricks you are using for BMP can translate to CMP, and that would be what I would suggest you do that as the simplest path forward. Your performance will probably be the about same as it was with BMP.
Personally, I recommend only storing XML in database fields if that XML is treated as a raw block of unprocessed text in all your SQL logic. In particular, if you need to perform queries on data values inside your XML, things get very messy.
Thank you for your reply Paul.
I probably will not use the XML approach as we might have to perform some
queries on the stored user-defined data. I was just trying to see if anybody has work on the XML capabilities of the databases. I know that Oracle has a product that allows storing XML in the database and querying that data using standard SQLs. Of course I am not 100% sure about it.
With the CMP/CMR, the implementation would be simpler.