Bugs item #796241, was opened at 2003-08-27 22:29
Message generated for change (Comment added) made by slaboure
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: Sacha Labourey (slaboure)
Date: 2003-08-28 17: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 16: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 13: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

Reply via email to