|
I have been trying to create a new domain class on an existing table but I keep getting this error when running a simple integration test:
No signature of method list() is applicable for argument types: () values: []Possible solutions: list(), list(java.util.Map), is(java.lang.Object), wait(), lock(), find() My domain class is:
package RIMS
class CodeTable {
static constraints = {
}
String module
String fieldName
String fieldDesc
int codeLength
int descLength
String userMaintained
String sysGeneratedCode
String tranUser
String tranType
Date lastUpdated
Date dateCreated
Date dateArchived
//static hasMany = [values:CodeValue]
static mapping ={
// Uncomment for Grails 2.0.
datasource 'rims'
table 'CODE_TABLE'
version true
sort "fieldName"
module column: 'module'
fieldName column: 'field_Name'
fieldDesc column: 'field_Desc'
codeLength column: 'code_Length'
descLength column: 'desc_Length'
userMaintained column: 'user_Maintained'
sysGeneratedCode column: 'sys_Generated_Code'
dateCreated column: 'DATE_ACTIVE'
dateArchived column: 'DATE_ARCHIVED'
tranUser column: 'TRAN_USER'
lastUpdated column: 'TRAN_DATE_TIME'
tranType column: 'TRAN_TYPE'
}
String toString() {
return "${fieldName}"
}
def beforeInsert = {
tranType = "Insert"
tranUser = "RIMSI"
}
def beforeUpdate = {
tranType = "Update"
tranUser = "RIMSI"
}
static listCodes(String module){
withCriteria(){
eq('module', module)
isNull('dateArchived')
order ('fieldName', 'asc')
}
}
}
The Test is defined like this:
package RIMS
import static org.junit.Assert.*
import org.junit.*
class CodeTableIntegrationTests {
@Before
void setUp() {
// Setup logic here
}
@After
void tearDown() {
// Tear down logic here
}
@Test
void testListCodes() {
CodeTable code1 = new CodeTable(id:1,
fieldName:'ROAD_TYPE_CODE',
dateCreated: new Date()-20
)
CodeTable code2 = new CodeTable(id:2,
fieldName:'ROAD_TYPE_AUX_CODE',
dateCreated: new Date()-20
)
def results = RIMS.CodeTable.list()
println "results: ${results}"
assertEquals 5, results.size()
}
}
I have four other domain classes defined that do not cause an issue. Any suggestions would be appreciated. I have created another class with just 3 fields on another existing table, this is also giving the same error. |
|
I've had the same problem while attempting to upgrade my 1.3-based application to 2.0.4. The upgrade process has not been smooth --- many of the plugins I was using no longer work, have all sorts of new errors, etc. But the one I couldn't get past was the one you're reporting here --- "No signature of method list()". I'm using list() is a perfectly ordinary way: DomainClass.list(max:1) --- doesn't work. I read elsewhere the problem might be the hibernate plugin isn't installed --- I tried forcing it to install version 2.0.0 by adding it to BuildConfig --- but that did not solve it.
Any ideas? For now, I've abandoned 2.0.4 and have gone back to 1.3. It just doesn't seem ready for prime time yet, or the upgrade instructions need to be updated. I ran into a slew of problems not mentioned in the upgrade instructions --- for instance I had to delete all my plugins from .grails, clear the ivy-cache, update BuildConfig.groovy to remove workarounds for issues in plugins, etc. -- all of which might be noted in upgrade docs. Even after all this, I'm still stuck on the above error. I think it might be worthwhile if someone at Grails went through and migrated most of the existing plugins to Grails 2 and/or write a guide to help us upgrade them ourselves. |
|
mitsu wrote:
> I've had the same problem while attempting to upgrade my 1.3-based > application to 2.0.4. The upgrade process has not been smooth --- many of > the plugins I was using no longer work, have all sorts of new errors, etc. > But the one I couldn't get past was the one you're reporting here --- "No > signature of method list()". I'm using list() is a perfectly ordinary way: > DomainClass.list(max:1) --- doesn't work. I read elsewhere the problem might > be the hibernate plugin isn't installed --- I tried forcing it to install > version 2.0.0 by adding it to BuildConfig --- but that did not solve it. > > Any ideas? For now, I've abandoned 2.0.4 and have gone back to 1.3. It just > doesn't seem ready for prime time yet, or the upgrade instructions need to > be updated. I ran into a slew of problems not mentioned in the upgrade > instructions --- for instance I had to delete all my plugins from .grails, > clear the ivy-cache, update BuildConfig.groovy to remove workarounds for > issues in plugins, etc. -- all of which might be noted in upgrade docs. Even > after all this, I'm still stuck on the above error. > > If you can create the problem in a sample app and attach it to a JIRA we can either identify what is wrong with the app or fix the problem in the framework. Jeff -- Jeff Brown SpringSource http://www.springsource.com/ Autism Strikes 1 in 166 Find The Cause ~ Find The Cure http://www.autismspeaks.org/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by humpy125
You have two issues in your code.
First, (and the primary problem) is that you are not successfully creating a datasource for your domain. I verified this by checking that no GORM methods work in your test (not just list). It is caused by the fact that you have datasource 'rims' on your domain class. For whatever reason, this datasource name is not working. If you comment that line out, you will have access to GORM methods (like list) using the default in-memory datasource. Second, you aren't calling save when creating the domain classes, so they are never being persisted. Add this to the object creation lines .save(flush: true, failOnError: true). When I do this, it's telling me that you have a bunch of constraint problems to work through in order to successfully create your sample data. Once you fix these two issues, your test(s) should pass. Please let me know! Hope that helps! Bobby |
| Powered by Nabble | Edit this page |
