Create physical table by text info

a json string with some schema info, just like

  "tableName": "test",
  "columns": [
        {  "name": "id",
           "iskey": true,
            "comment": "id column",
            "type": "number",
        {  "name": "UserName",
           "iskey": false,
            "comment": "the user's name",
            "type": "string",

i want to use hibernate to dynmic load json info and create the table in database.

is any way to achieve it, tks.

i have look into the source code, and find Metadata interface, there has so many methods, if create a custom Meatadata implementation should be a hard work. and i don’t know how to used the custom implementation .

Hibernate is an ORM not a DDL tool and this is not really a use case that is intended to be supported. Having said that, you could use the classes org.hibernate.mapping.Table and org.hibernate.mapping.Column to model this which then can be exported to DDL.

thank you, is any other tool or library can achieve it. in my requrement, i have huge number of table schemas to creating in some type of database.

if i use java emit to creating entity dynamically, is any way can tell hibernate to loading it.

You can create tables with by using the classes I mentioned. I have no idea what you are trying to do. If all you want is to create SQL DDL, this should be fine.