Earlier this year I worked on a project using Grails 1.2.x and Oracle 10g, and things went very well. It's been a little while, but now I'm in a new environment, and having problems with getting very simple integration tests to persist objects, with some strange errors and other stranger errors. First, the problem:
I have an (simplified) domain object representing an application in Application.groovy
The mapping is needed because this is an existing table, and after this gets our of development I will set the cache: to readonly.Code:class Application { String applicationName String applicationDescription String applicationStatus static constraints = { applicationStatus(nullable:true, inList:["Plan", "Retire", "Build", "Operate", "Decommissioned"]) } static mapping = { table 'app_applications' } }
In my integration test I have a method like the following:
When I run this test with "grails test-app" I get the following:Code:void testSimpleSave() { def app = new Application( applicationDescription: 'desc', applicationName: 'name', applicationStatus:"Plan" ) assertNotNull app.save() assertNotNull app.id def foundApp = Application.get(app.id) assertEquals 'name', foundApp.applicationName }
I take this error to mean that the object (app) to be persisted is null after the new().Code:Testcase: testSimpleSave took 0.61 sec FAILED junit.framework.AssertionFailedError: null junit.framework.AssertionFailedError: junit.framework.AssertionFailedError: null at com.jpmc.gti.gssd.brews.ApplicationIntegrationTests.testSimpleSave(ApplicationIntegrationTests.groovy:22)
The table that the mapping points to exists, and if I scaffold a grails controller for this domain object, everything seems to work perfectly, including calling save() from the grails app.
I'm using Grails 1.3.3 and Oracle 11, with the dialect = "org.hibernate.dialect.Oracle10gDialect".
Any thoughts here? I would appreciate any insights.
Brian


Reply With Quote