Ivens,
your int CMP fields should definitely be NOT NULL. Consider what happens 
if you have a NULL int column. What should happen when you read a NULL 
value from the DB?
int i = null; is not valid Java code.
int i = 0; is correct Java code, but then you are assuming that NULL and 0 
are equivalent for your field.

The solution should be that if you want nulls in your numeric data, then 
you use an java.lang.Integer, and then:
Integer i = null; is good code.

Hope this helps,
Jonathan O'Connor
XCOM Dublin




Ivens Porto <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
23.10.2003 21:48
Please respond to jboss-user
 
        To:     [EMAIL PROTECTED]
        cc: 
        Subject:        [JBoss-user] PostgreSQL and NOT NULL integer 
fields


Hi,

I'm using JBoss 3.2.2 and PostgreSQL 7.3.4.

JBoss is doing something that I can't figure out why. 

In my CMP beans, JBoss always use the constraint NOT NULL for fields of
type integer, even thought I don't set the <not-null/> property in
jbosscmp-jdbc.xml for the fields.

If the persistent field in the CMP bean is of type int or Integer, JBoss
creates the database table with the constraint NOT NULL for integer type
fields.

Does anyone knows why JBoss does this?
-- 
                                      _/_/_/       _/_/_/        _/_/_/
Ivens Porto                         _/     _/    _/            _/
OSE - Open Systems Engineering     _/     _/    _/            _/
http://www.ose.com.br             _/     _/      _/_/_/      _/_/_/_/
Phone: (55) 34 - 3214-5995       _/     _/            _/    _/
Fax:   (55) 34 - 3214-5994      _/     _/            _/    _/
                                 _/_/_/        _/_/_/       _/_/_/


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user




-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to