Roo and GWT problem
Hello, I need to use GWT (corporate decision) and I would like to use Roo. But I'm meeting lots of problems even in simple projects. I have simple script like this:
Then exit and mvn gwt:run
project --topLevelPackage com.springsource.roo.testroo
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity jpa --class ~.domain.Service --testAutomatically
field string --fieldName SRV_ID --notNull --sizeMax 3 --sizeMin 3
field string --fieldName SERVICE --notNull --sizeMax 20
web gwt setup
web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request
The web page starts but when I click on Create Service there is browser pop-up error:
Application Scaffold in GWT Development Mode gives more info:
Error: One or more exceptions caught, see full set in UmbrellaException#getCauses
Am I doing something wrong? I tried to resolve it by myself but allmost all tutorials and helps on the net are for Roo 1.1 which is diferent and they didn't work well.
[ERROR] Could not find a getter for path sRV_ID in proxy type com.springsource.roo.testroo.client.proxy.ServiceProxy
[ERROR] Could not find a getter for path sERVICE in proxy type com.springsource.roo.testroo.client.proxy.ServiceProxy
[ERROR] Unable to create Editor model due to previous errors
I am using Roo 1.2.2, Maven 3.0.3
It's funny how I resolve the problem everytime after posting question on the forum.
The problem were actually names of fields. After changing name to "srvid" and "name" the application works well.
Should I delete this thread then or leave it for others?
I'd leave it here for others. Are you saying that naming a field 'name' is a problem?
Well I played with it lately and it's quite funny :) The problem was uppercase and lowercase characters of the field name but it's not that easy :) I used original names - SRV_ID and SERVICE. Here's what I discovered:
Only first two characters of the fieldName are important
1. When the 1st character is uppercase and the 2nd is lowercase the maven build mvn gwt:run will fail with error
2. When the 2nd character is uppercase and the 1st is lowercase the maven build will run ok, the website will load ok but it will fail when I want to create new service (with error like in OP)
3. When the 1st and 2nd character is uppercase the situation will be same as in 2.
4. When the 1st and 2nd character is lowercase then everything works well.
Short version: first two characters must be lowercase :) (At least in my project). Funny :) Is it somewhere in manual or in reference?
I suggest a read of the java beans specification as that is basically is what you describe :)... The second letter uppercase is basically an exception to the normal rule of propertyName -> getPropertyName rule... The getter is then pRopertyName -> getpRopertyName...
So it might be that there is either something fishy in Spring Roo Jpa stuff of GWT stuff (or maybe GWT itself)?