Grails There is no type or column for the column [order_items_order_item] in the domain [rewards.OnlineOrder] referencing [rewards.OrderItem]

This way, I keep getting the theme line error when I try to start the grails application. Here are my two domain classes that seem to be causing the error.

OnlineOrder:

package rewards

class OnlineOrder {

    Date orderDate
    Integer orderNumber
    Float orderTotal

    static belongsTo = [customer:Customer]
    static hasMany = [orderItems:OrderItem]

    static constraints = {
    }
}

OrderItem:

package rewards

class OrderItem {

    Integer qty
    Float total

    static belongsTo = [orders:OnlineOrder, product:Product]

    static constraints = {
    }
}

The error reads as: Caused by: org.hibernate.MappingException: Missing type or column for column[order_items_order_item] on domain[rewards.OnlineOrder] referencing[rewards.OrderItem]

He seems to be saying that he has not defined OrderItem yet, and I refer to him as a child in my OnlineOrder domain. But I can’t understand why this is causing the error. The OrderItem class is created in the same directory as OnlineOrder, and is quite simple.

Any suggestions?

+4
source share
4 answers

Starter IDE. IntelliJ make, Grails/Gorm -. GrailsAutoConfiguration Artefact scanUsingPattern.

javap - .

grails run-app .

0

, . - , domin db .

,

0

, .

grails clean

grails -reloading run-app

If your project uses migrations, it is recommended that you put the database in a stable state and then run the following commands:

grails clean
grails dbm-clear-checksums
grails dbm-update
grails -reloading run-app
0
source

Try:

package rewards

class OrderItem {

    Integer qty
    Float total
    OnlineOrder onlineOrder
    Product product

    static belongsTo = [OnlineOrder, Product]

    static constraints = {
    }
}

And use BigDecimal instead of Float.

-1
source

All Articles