简体   繁体   English

结合使用HSQL MEMORY TABLE和grails

[英]Using HSQL MEMORY TABLE with grails

是否可以在grails中定义某种映射,以便针对特定grails域将CREATE TABLE替换为CREATE MEMORY TABLE

If you wanted to do this for all tables, you could create a custom Dialect and override getCreateTableString() but there's no way to know the current table name, so it can be selectively applied. 如果要对所有表执行此操作,则可以创建自定义Dialect并覆盖getCreateTableString()但是无法知道当前表名,因此可以有选择地应用它。

But you can take the approach I suggested here: grails limited table creation . 但是您可以采用我在这里建议的方法: 限制表的创建 You would just override generateSchemaCreationScript() and if you find the table(s) you're looking for, you can replace the 'create table' string with 'create memory table'. 您只需要覆盖generateSchemaCreationScript() ,如果找到了要查找的表,则可以将“创建表”字符串替换为“创建内存表”。

The create table statements are generated by Hibernate's hbm2ddl feature. 创建表语句是由Hibernate的hbm2ddl功能生成的。 I don't think there is a way to configure the syntax of the create statement other than the table name itself and the columns. 我认为除了表名本身和列之外,没有其他方法可以配置create语句的语法。

You would have to manually manage the schema creation using a plugin like Autobase or Liquibase (or whatever they have coming in Grails 1.4 to handle DB migrations). 您将必须使用诸如Autobase或Liquibase之类的插件(或它们在Grails 1.4中提供的用于处理数据库迁移的任何插件)来手动管理模式创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM