users@glassfish.java.net

Re: Can JPA cope with a dynamic schema?

From: <glassfish_at_javadesktop.org>
Date: Thu, 31 May 2007 18:22:26 PDT

You should take a look the Entity Attribute Value Schema ( link below) . Also, keep in mind that it can complicate the queries you might need to write if you need to do aggregation or other types of queries that might be better suited to a traditional table schema. However, it appears if you do a little googling you could find some success stories. This is one way.

OR

Also, why not just write out a new annotated class and compile it, add it to your database classes jar file when the user defines a new table. Then load the class dynamically.
This post below is slightly related if you read far enough down. It might be a possible solution

http://forums.java.net/jive/message.jspa?messageID=204835
[Message sent by forum member 'jdaggs' (jdaggs)]

http://forums.java.net/jive/thread.jspa?messageID=219847