IntroductionThis page details how to install and use the Grails 400 Utilities via a standard Grails plugin. DetailsSteps to create a Grails project and generate Grails domain classes from System i files - Note: These directions assumes Grails has already been installed and configured to your PC
- From DOS:
- Change to a working directory to which a Grails project will be created
- Create a grails project
- > grails create-app yourprojname
- Change the directory to the newly generated Grails project
- > cd \grailswork\yourprojname
- Install the System i Grails Domain Tool plugin
- Use the plugin to reverse-engineer a 400 file into a Grails domain
- > grails build-systemi-grails-domain
- this will prompt for ip, user, password, library, file, and domainName
- optionally, you could type the arguments in the command string space delimited:
- > grails build-systemi-grails-domain 172.16.1.4 denoncourt secret mylib custmast Customer
- If you get a stack trace, run the following and it should work on a second try:
- > grails clean
- I'm not sure why this happens but it should be fixed in a subsequent release
- You will get a message "be sure to modify grails-app/conf/DataSource.groovy to specify your System i settings" and then list the code such as (but with your info):
dataSource {
pooled = true
url = "jdbc:as400://yourip/yourlib"
driverClassName = "com.ibm.as400.access.AS400JDBCDriver"
username = "yourusername"
password = "yourpassword"
dialect = org.hibernate.dialect.DB2400Dialect.class
}- paste/replace that dataSource code over the dataSource specified within the development section, you should see the following in your DataSource.groovy file:
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'
url = "jdbc:hsqldb:mem:devDB"
}
}Use the Grails utility to generate the controller and views - > grails generate-systemi-all yourGrailsDomainName
- Note: to handle legacy data, the System i Grails Domain generator also replaced the default Grails controller and page view templates.
- Note: the standard generate-all and generate-controller tasks may not behave properly after installing this plugin. But the code generated by these tools does not work with legacy systemi tables/domain objects anyway.
Test your application
|
I have tried the GrailsProjectPlugin to generate a CRUD for a generic entity stored in System i.
I have two problem.
In edit view of a record the field are empty.
When I try to create a new record i receive two type of error:
Failed to convert property value of type java.lang.String? to required type boolean? for property newEntity; nested exception is java.lang.IllegalArgumentException?: Invalid boolean value Failed to convert property value of type java.lang.String? to required type int? for property ts2nums2; nested exception is java.lang.IllegalArgumentException?: Cannot convert value of type java.lang.String? to required type int? for property ts2nums2: PropertyEditor? org.springframework.beans.propertyeditors.CustomNumberEditor? returned inappropriate value
Where ts2nums2 is the field name.
Any issue?
Thank's in advance.