I am assuming that you are talking about CMP entity beans here:
How do you assign null to a primitive type?
Since it is not legal to write:
int i = null;
you must use a java.lang.Integer instead.
I understand what you are saying completely however I was thinking that if it is possible in the JDBC API (getInt() returns 0 if null) shouldn't we consider it implementing it in JBoss, or is it some kind of spec violation to do so, or goes agains't some philosophy?
If so, then somebody please post their response here as I would like to learn, understand and gain an insight into what other people think on this topic.
Well, aside from the fact that this behavior is mandated by the spec, there is no formal relationship between JDBC and CMP.
Most implementations will use JDBC to access database tables, but there is nothing in the rule book that says this must be so. An implementation could, for example, use a JNI interface and the Oracle Call Interface if it wanted.
The only way a CMP implementation has of transmitting the fact that a column is NULL is to return null to the user. The behaviour that you desire is trivial to implement in your own entity bean.
Thank you for your reponse.
I have already implemented the change in my EntityBean. I was only asking the questions above for my own good, so that I could better understand what I am doing.
Thanks so much, again!!