What is the best way to change database table schema at run time in Pl开发者_JS百科ay! Framework? I get an unspecified amount of columns from a client application and can not have domain objects.
Another option may be to use a schema-less datastore ala mongodb. Seems like there is a mongo module for play, http://www.playframework.org/modules/mongo.
Why not using Apache DDLUtils ?
It's not plugged by default in Play! but I use it in other projects and it's quite useful.
http://db.apache.org/ddlutils/
I think this is exactly what you were looking for
have a look at play snippets
http://www.playframework.org/community/snippets/13
public class Application extends Controller {
@Before
public static void setDBSchema() {
    String schema = "someSchema"; // This can come from a Cache, for example
    Play.configuration.setProperty("hibernate.default_schema", schema);
    JPA.entityManagerFactory = null;
    JPAPlugin plugin = new JPAPlugin();
    plugin.onApplicationStart();
}
...
you just change the configured hibernate schema, and then force the JPAPlugin to restart
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论