>> in fact we already use a table with a field for each table. This
>> works quite good. Thanks for the idea to cache it via a static field.

Some comments regarding static fields in ejb objects.

1) Static fields are critical sections.
        That means (in the general case) they must be managed by a synchronized
block.
        This synchronization may conflict with the container's synchronization.

2) Static fields belongs to a Class object and Class objects belongs to a
ClassLoader.
        That means (in the general case) it's possible to have two (or more)
        different static values - one for each ClassLoader. In a "normal" Java
program
        this scenario is unlikely.
        However, sooner or later the bean, with static
        non-constant fields, executes inside a container performing dynamic
        class reloading. Depending on the implementation details it may happen that
        an "old" bean belonging to an "old" class loader co-exists with a "new"
bean
        belonging to a "new" class loader.
        That, is a pretty nasty bug to find!

I have read somewhere, that beans shouldn't have static fields.
At least no non-constants.

Anyone agree?

Best regards,
        Jens Riboe

-------------------------------------------------------
Jens Riboe / Ribomation AB
-------------------------------------------------------
Email: [EMAIL PROTECTED]
WWW : http://www.ribomation.se/
Phone: 08-754 67 70 (Int. +46-87546770)
Fax : 08-754 67 71 (Int. +46-87546771)
Visit: Bergk�llav�gen 32, Bredden/Sollentuna/Stockholm
-------------------------------------------------------
Ribomation AB
Box 303
SE-19230 SOLLENTUNA
Sweden
-------------------------------------------------------

Jens Riboe.vcf

Reply via email to