2011-10-18 32 views
0

我有一個問題如下所示;沒有簽名的方法:static org.springframework.security.oauth.User.withTransaction()

groovy.lang.MissingMethodException: No signature of method: 
    static org.springframework.security.oauth.User.withTransaction() is applicable for argument types: 
    (org.springframework.security.oauth.services.UserService$_saveUser_closure1) values: 
    [org.springf[email protected]2ed1e8 at 
    groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1357) 

UserService:

class UserService { 

    public boolean saveUser(){ 
    boolean retVal=false; 
    User.withTransaction{status -> 
     def sUser = new User() 
     sUser.setUsername("muhammed") 
     sUser.save() 
     retVal= true 
    } 
    return retVal; 
    } 
} 

User.groovy:

@Entity 
class User { 
    String id; 
    String username; 
    String password;//social agent id 

    static constraints = { 
    username(nullable:true) 
    password(nullable:true) 
    } 
    static mapping = { 
    id generator: 'uuid' 
    } 
} 

什麼是我不能發現問題?

回答

1

我相信你在你的服務中導入了錯誤的用戶類。最有可能你有類似

import org.springframework.security.oauth.User 

在你的UserService.groovy文件上,而你需要導入你的域類。

+0

我改變了休眠它現在工作,groovy真的生病我:) –

相關問題