I guess it is just an effort to be as purely abstract as possible. If I were to follow the design, development, production guidelines I set for my organisation then runtime modification of the environment would be a bit no-no. However I have no control over the data sources and experience has shown that they do add additional data pretty regularly and some of that data could be useful in the reports we generate.
Since my app allows the user to drag and drop field data from imported data sets when generating custom reports, I'd like to include this new data on the fly if possible. Chris From: Daryl Stultz [mailto:[email protected]] Sent: Friday, 24 July 2009 2:15 AM To: [email protected]; OpenJPA User List Subject: Re: Dynamic entity definition creation - is it possible? On Thu, Jul 23, 2009 at 11:59 AM, C N Davies <[email protected]> wrote: I'm a bit of a puritan when it come to abstractions, and while abstraction is a great thing I must confess to feeling that sometime I take it to the n'th degree and try push it too far. Well, we could argue forever on such things - I've had some pretty heated discussions with developers that feel the need to push things too abstract. I like to balance the abstract with the practical (and the budget!). All of my entities are created (integrated using a fileinputstream of CSV or XLS/XLSX) using a model whereby I read the file headers then search for a setter method that uses "set"<column header name>, then call the setter. I definitely get what you are trying to do, though I don't know why. A Class is a template for an object that has certain known properties and behaviors. Since you are modifying it at runtime, you don't really know anything about the new properties. You don't have any code that calls getWidget() just in case the new CSV file has a new column called "widget". So is this just a "puritanical" issue or do you have a good reason not to simply use a Map of some kind to extend the core entity? Reflection is a great way for a running system to discover the fixed definition of things, but it seems like you are using a form of reflection on both sides of a running system which ultimately doesn't look any different to the coder developing around it. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:[email protected]
