Bugs item #796241, was opened at 2003-08-27 23:29 Message generated for change (Comment added) made by loubyansky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=796241&group_id=22866
Category: JBossCMP Group: v3.2 Status: Closed Resolution: Rejected Priority: 5 Submitted By: Jari Juslin (zds0) Assigned to: Alexey Loubyansky (loubyansky) Summary: JBoss throws NPE if CMP int field is NULL in DB Initial Comment: JBoss 3.2.1, Red Hat Linux 6.2, Sun JVM 1.4.2 JBoss throws NullPointerException when it loads CMP entity bean from database if CMP field has type int and there is value NULL in database. This happens at least with EJB 1.1 CMP entity beans. Attached is a patch against JBoss 3.2.1 that fixes this problem by setting the field value to 0 and whining to log. ---------------------------------------------------------------------- >Comment By: Alexey Loubyansky (loubyansky) Date: 2003-08-28 18:56 Message: Logged In: YES user_id=543482 I agree to throw IllegalStateException with the corresponding message. In the given case, I think, you should accuse BEA that your application is not portable. NULL obviously does not equal 0. And you relied on the app server specific feature. Sometimes, we do adopt some worthy features from our competitors, but this one is not of them. ---------------------------------------------------------------------- Comment By: Sacha Labourey (slaboure) Date: 2003-08-28 18:47 Message: Logged In: YES user_id=95900 Sure, but the problem is not jboss or not jboss, bea or not bea. The problem, if any, is in the EJB spec. Frankly, considering that it is better to silently decide that NULL=0 (no effect on addition) is a little bit a cowboy attitude. What if I was considering NULL=1 (no effect on multiplication). ---------------------------------------------------------------------- Comment By: Jari Juslin (zds0) Date: 2003-08-28 18:44 Message: Logged In: YES user_id=808897 It's not always question of wanting or not wanting. For example, when we migrated from Weblogic to JBoss, JBoss deployed fine but then later on started to behave inconsistently. JBoss is pretty damn complex piece of software; you can't expect any resent user to know it totally and thus know that you have to do some special means in order for it to behave correctly. It has to be able to behave as correctly as possible, even with broken input, and in this point I think the best way should be warn the user in the deploy time. Weblogic OTOH just ignores the NULLs; it doesn't change them, but they do not prevent it from working either. I agree with you that this is bad, because it hides problems. This just means that when you migrate from WL to JBoss, your software might break in a ways you couldn't predict. ---------------------------------------------------------------------- Comment By: Sacha Labourey (slaboure) Date: 2003-08-28 18:08 Message: Logged In: YES user_id=95900 I agree that the message could/should be better, but throwing an exception is perfectly fine. If you don't want an exception don't use Int but use java.lang.Integer instead and it will work perfectly, like "enterprise level server software" (TM) ---------------------------------------------------------------------- Comment By: Jari Juslin (zds0) Date: 2003-08-28 17:59 Message: Logged In: YES user_id=808897 Yep, it _is_ inconsistent then, but if JBoss wants to behave like enterprise level server software, it can't just throw NPE on invalid input and go into half-working state. At least it should throw some reasonable exception describing the problem and letting client application handle the issue in the normal manner. Besides that, NULL values for primitive types are question of synchronizing bean descriptors and database structure. I acknowledge that these _should_ be consistent, but in the real world there is not always a possibility to change the db structure at every point. Especially when starting to use beans in places where DB access has been made with direct JDBC calls before, this kind of things are pretty routine stuff. And I would like migrating to JBoss to be as clean as possible. In fact, one pretty clean solution would be to check on _deploy time_ if DB structure allows NULL values for primitive field. This way JBoss wouldn't hide the problem just to crash later on but let the user correct it before any malfunction can happen. ---------------------------------------------------------------------- Comment By: Alexey Loubyansky (loubyansky) Date: 2003-08-28 14:10 Message: Logged In: YES user_id=543482 I disagree. NULL value for a primitive type means inconsistent data. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=796241&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development