I have an very urgent problem with JOnAS 2.2.4 I hope the JOnAS crew can help. I think
it is a bug in JOnAS:
I made a simple CMP EB that maps a table 1:1. I do a findByPrimaryKey (PK is a single
int) and get back an instance. Now I
try to get (!) any field from that entity and JOnAS server excepts with an SQL error
that some of my field may not be empty
in ejbSave. WHAT?! This only happens with this bean, all others work. I made up this
bean a second time, same error. The code
is 100% ok.
Fact is, even if transaction is set to Required (NOT RequiredNew) and I did NO changes
and that call is NOT at the end of a
transaction (it's quite in the middle, some things happen before, some after; I do NOT
use client-demarcated transaction but
only CMT), JOnAS thinks my bean is modified and wants to write it back! This happens
EVER, definitively. The bean is no
special thing, it's made with EJBWizard without ANY modification (all 100 other beans
I made with that tool are ok. The code
is OK, definitively. It's no bug in EJBWizard definitively).
So, I think here are three problems:
1) JOnAS wants to write back to database without any need (what need should be to
write back when I do a getXXX() ? )
2) JOnAS seems to change data between load and save (if not, why can't data be written
that was read in the same transaction
one millisecond before: there is neither a trigger nor check; it's a simple "foreign
key constraint" that fires here!).
2) JOnAS writes back all data even if it is not dirty: GenIC produces code that always
tells that the whole entity is dirty,
even if it isn't!
For this is a real problem for me, for ANYONE this may lead to very poor performance:
Not only that JOnAS writes back every
time it wants to without need, it also writes back unchanged beans! Besides fixing
that bug I would suggest to include not
only one dirty field per Entity but one per field as it is quite common in serveral
OR-Mapping-Tools for years (e. g.
Microsoft MFC; it handles a dirty flag per field) and only putting that data into the
SQL that needs to be updated (for JOnAS
does not reuse prepared statements, this would be possible; just put together the
string dynamically).
PLEASE HELP !
Markus