2016-02-05 19 views
0

我正在使用Grails 2.4.0。並且在linux上創建應用程序並進行部署。使用Grails在Linux環境下不顯示布爾值

我的域名

class UserDetails { 

    String userEnvironment = "" 
    Long userId   = 0L 
    Boolean accountCreated = false 
    Integer retries   = 0 
    String password  = "" 
    boolean accountCreationInProgress = true 

static constraints = { 
    accountCreationInProgress nullable : true 
} 

} 

當保存其對windows.But accountCreated做工精細和accountCreationInProgress列是在Linux上的空白。爲什麼不知道。

任何人都請幫助我。

+0

爲什麼你使用'boolean accountCreationInProgress'作爲可爲空而不是'Boolean'?你使用的是哪個數據庫?在windows下和linux下部署是否一樣? –

+0

使用mysql數據庫 – AtulJain

+0

如果我說刪除UserDetails c其中c.accountCreated = true它不刪除記錄。 – AtulJain

回答

1

更改爲:

class UserDetails { 

    StringuserEnvironment = "" 
    LonguserId= 0L 
    Boolean accountCreated= false 
    Integer retries = 0 
    Stringpassword= "" 
    Boolean accountCreationInProgress = true 

    static constraints = { 
    //there is no point to use nullable for accountCreationInProgress if you set it default to true value during create 
    } 

} 

請記住,在數據庫應用程序的重新運行前刪除表。

+0

它真的有用嗎?並刪除查詢將工作。 – AtulJain

+0

是的。 'UserDetails.findAllByAccountCreated(true).each {it.delete(flush:true)}' –

+0

UserDetails.executeUpdate(「delete UserDetails c where c.accountCreated = 1」)這個怎麼辦? – AtulJain