I might be thinking in the wrong direction so feel free to berate me if I
am.

 

My app imports data from various sources including excel (uses Apache POI),
CSV, SQL result set etc. Prior to starting to use OpenJPA, if my import
processes noted any changes to the incoming data set (ie additional fields)
I would dynamically generate SQL to  modify the data tables to accommodate
any changes to the incoming data set. (ie a vendor adds a new column to a
spreadsheet I imports regularly so I add the required columns) and then
commit the new data so that any changes to the structure of the incoming
data can be dynamically managed at runtime.

 

Since JPA requires class files to define the structure of an entity, if I
have an entity class that expects certain fields, but I receive an
additional column in my incoming dataset, then my entity will just miss the
new data.

 

I was thinking that maybe there is a solution that would function at runtime
like this:

 

1.       Examine the incoming data from a CSV file for example (easy to do
and already done)

2.       Create the appropriate entity definition at runtime (possible ???)

3.       Create an instance of this new definition  (assuming 2 can be done
this should be as per usual)

4.       Populate the new instance (assuming 2 can be done this should be as
per usual)

5.       Call OpenJPA persist/merge (What about JPA enhancement of the
modified/generated entity classes?)

 

I do understand the implications of doing this kind of dynamic restructuring
in a production system, however I'm painting a generic picture of my thought
process here in order to convey a concept rather than babble on about the
specifics of the system.

 

Have I lost the plot or can this be done using OpenJPA?  I've read the whole
doc a dozen times, search the mail lists but can't see any way to do it. 

 

Thanks!

 

Chris

 

Reply via email to