This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
if to send a null value while binding the variables to callble statement. suppose in following statement contractseq is int. Then how to send this value as null.We can use setNull method to set it as null. But I need to initialse contractseq as null, how to do this? INTEGER can set to null,but how to set int as null. csorder.setInt(20,p_contractseq); regards Pavan
Since a Java "int" can't ever be null you have a couple of choices. Either you make a convention that a null will be represented by an unlikely value (such as Integer.MIN_VALUE), or you use an "Integer" instead. In the first case, if you want to set an "int" to null, you set contractseq = Integer.MIN_VALUE. Inside the receiving method you check for a value of "Integer.MIN_VALUE" and if found do a "setNull()", otherwise do a "setInt()". This works, but it is sorta' ugly, and would prevent you from ever storing Integer.MIN_VALUE in the database. The second option means you have to wrap/unwrap the "int" value, but allows you to pass a null around.