Open GoogleCodeExporter opened 9 years ago
updated the zip
Original comment by aj.gray...@gmail.com
on 22 Jul 2010 at 3:31
Attachments:
Original comment by bguijt
on 21 Aug 2010 at 9:04
[deleted comment]
[deleted comment]
it appears as thought doing anything with a numeric value that can also be null
is causing a problem. for example, say you have an optional column named "Age"
in a table named Persons. You create your Person class extending
JavaScriptObject and add this method:
public native int getAge() /*-{return this.Age;}-*/;
if you call getAge() and the value is null in the db, you get a
HostedModeException.
It makes sense to get that exception as an int can't be null so, i'm not sure
you can actually "fix" this.
i have come up with a workaround though it's not ideal:
private native int getAgeJsVal() /*-{
var ret = -1;
if ( this.Age )
{
ret = this.Age;
}
return ret;
}-*/;
then, create a public method like so:
public Integer getAge()
{
return getAgeJsVal() == -1 ? null : getAgeJsVal();
}
Original comment by aj.gray...@gmail.com
on 31 Aug 2010 at 7:48
Original issue reported on code.google.com by
aj.gray...@gmail.com
on 22 Jul 2010 at 3:26Attachments: