Reputation: 514
Is it possible to create tables in run-time without being worry about create table proprietary syntax of different databases and other things that can be managed by GORM or Hibernate ?
I need to create and manage somes table dynamically in run-time and don't need to ORM for them.
Upvotes: 2
Views: 490
Reputation: 3597
Hey it seems this question was asked in the question how can i create a dynamic domain class in grails. Yet Burt's answer of the dynamic domain class plugin seems to be abandoned.
I would recommend using raw SQL for now as described in the SQL Groovy Docs. Here is a quick example (make sure your database id has proper permissions)
def sql = new Sql(dataSource)
sql.execute '''
create table PROJECT (
id integer not null,
name varchar(50),
url varchar(100),
)
'''
sql.close()
Upvotes: 1