English 中文(简体)
• 如何为铁路总局的外国钥匙制定指数
原标题:How to create an index for foreign key in Grails GORM

附录

class User {
    static hasMany = [books:Book]
}

class Book {
    static belongsTo = [user:User]
}

戈尔姆为图书表增加了用户栏和外国钥匙。 我如何能够在这一栏中增加一个指数?

最佳回答

这似乎是最简单的运作方式。 你们不需要具体说明外国钥匙或其他东西。

class Book {
    static belongsTo = [user:User]
    static mapping = {
        user index: index_book_user_id 
    }
}
问题回答

我不敢肯定,Grails允许你在缺席的情况下这样做。 你可以具体指出,铁路公司使用某一栏表中的现有指数,但我认为,在铁路公司违约后指数的栏目中,需要人工制作索引。

Reference on GORM index use





相关问题
Entity Framework with File-Based Database

I am in the process of developing a desktop application that needs a database. The application is currently targeted to SQL Express 2005 and works wonderfully. However, I m not crazy about having ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签