on 01-22-2007 12:50 PM
I've defined an field in a CMP Entity Bean with type java.lang.Integer.
When the bean loads, if this field is null in the database, I always get a 0 value.
I've tried with oracle driver 9.2.0.8 and 10.2.0.2.
I've never had this error working with other Application Servers.
I'm starting to think that the EJB implementation of SAP WAS is very bad.
This field is a foreign key in my database table. Every time the bean load, if it has to make an update of one field, it updates the values all for the fields!!!, trying to set a 0 to this field, and it causes a constraint violation, because there is no register in the related table with id=0.
Help, please.
Hi,
What version and SP of SAP WAS are you using?
Could you elaborate a little bit more on the scenario? Do you use container-managed relationships (CMR)? What does the foreign key column refer to - another CMP bean table or some other table that is not managed by the EJB container?
Best regards,
Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using NW04sSR1.
I've done more tests, and the scenario is very simple.
I've only one CMP Entity Bean called TestBean, with 3 fields of type java.lang.Integer: field1 (pk), field2, field3. It's pointing to table Test in oracle database 9.2.0.7 (jdbc client 9.2.0.8), with the same 3 fields of type INTEGER and field3 nullable.
I insert a row in the table {1, 1, null}
I get an instance of the Entity from this row, in a test method in my stateless Session Bean, sets field2 to anything and voila! magically field3 mutates to zero 0.
When the beans load, field3 populates with 0 (debug and getField3). So when it makes the full update, of course, it stores this value.
Any idea? Thanks in advance.
Hi Aníbal,
This is a known limitation in the EJB container in SAP NetWeaver 04 and 04s (please check SAP Note 927201 ). It will be fixed in the next Support Packages.
Thanks and regards,
Vladimir
Hi,
I'm wondering where to finde the solution in note 927201?
As far as I understand, I can neither user primitive-type nor wrappers of primitive types to get null values from db into db-fields? Both types will be initialised to default-value.
This not a solution If you want to distinguish default- and null-value which have different meanings in the business-context?
So the only solution is to use BigDecimal? You can't use long and you can't use java.lang.Long!
Thomas
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.