Grails, How to create a runtime table using a dialect

Is it possible to create tables at runtime without worrying about creating the syntax of proprietary tables of different databases and other things that GORM or Hibernate can manage?

I need to dynamically create and manage somes tables at runtime and not need ORM for them.

+2
source share
1 answer

Hey, this question seems to have been asked in the question of how to create a dynamic domain class in grails . However, Bert's answer from the dynamic domain class seems to be abandoned.

I would recommend using the original SQL at the moment, as described in the Groovy Docs SQL . Here is a quick example (make sure your database id has the appropriate permissions)

def sql = new Sql(dataSource) sql.execute ''' create table PROJECT ( id integer not null, name varchar(50), url varchar(100), ) ''' sql.close() 
+1
source

All Articles