Thanks for your input. It looks like the consensus answer so far is No. JPA cant cope with a dynamic schema.
Let me explain a little bit more about the specifics of the application I'm writing.
Its going to be a web based issue\task tracking system.
I want to allow the users to define the attributes of the issue\task that they want to track by defining a issue\task type. After these types are initially defined (by an admin user, within the web app) they will change fairly in-frequently (again from within the web-app by an admin user). Because I want the application to be able to track millions of issue\tasks of any particular user defined type, I want each issue\task type to have its own table. For simplicity, scalability and performance, I want each issue\task to be contained as one row. [i](when the alternative static - fixed column - schema solution is having it spread across several tables and rows, an extra row per custom attribute, with value type id, a table for each value type text, number, date, etc (
http://en.wikipedia.org/wiki/Entity-Attribute-Value_model))[/i]
This is easy to achieve with standard sql thru jdbc with its alter and create table sql, I was just wondering if it was possible to access this kind of functionality from JPA. I wanted to use JPA so I my application could be database agnostic and because it would make storing my application data much simpler. Currently I'm storing things like the issue\task type definitions as serialised classes into a blob. Horrible I know and not a long term solution.
jdaggs, The workaround of creating a java class dynamically, adding the annotations sounds like a great idea, and I'll bear that in mind as a possibility. The Entity Attribute Value Schema (now i know its name!) idea is pretty much what Id have to do if I could accept a static schema solution.
Thank you all again for your input.
Cheers,
-Phil Wilkinson
[Message sent by forum member 'wilkinp' (wilkinp)]
http://forums.java.net/jive/thread.jspa?messageID=219964