Numeric null check on java server side failing with Flex BlazeDS AMF channel

One of the entities developed had a Numeric field as primary key, with a custom code to populate it rather than utilizing any auto generation strategy of JPA


I wrote junit to test this and obviously it passed -if ID was set to null it would generate an ID.
But the moment I integrated it with flex, things went bad and it would NOT generate the expected “First” ID.
Reason – I had used autobinding on flex side –


This resulted in “auto” initialization of integer filed to zero and hence the condition of ==null would always fail. Solution? -explicit check for null as well as zero:


About ChandanPandey

Try to come up with a good design as by product of good coding practices

Posted on January 4, 2013, in Flex, Java and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: