Generated SQL update statement is missing columns [message #727601] |
Wed, 21 September 2011 11:52  |
Eclipse User |
|
|
|
I have a case where the SQL UPDATE statement generated by EclipseLink does not include all the entity members that have changed.
I first noticed the problem with a web page where some fields were not showing changes that had been made to them.
I recreated the problem in a single EJB startup method by
- finding the entity
- detaching the entity
- change 3 entity fields (all Strings)
- merge the entity and flush
- find the entity again
In the above case, the 2nd entity shows all field changes having been made. However, if I query the DB directly or rerun the program, it is evident that one of the fields was not updated.
The EclipseLink logged SQL UPDATE is missing one of the 3 fields.
Any suggestions why this might be happening?
|
|
|
|
|
|
|
|
|
|
Re: (no subject) [message #731908 is a reply to message #729702] |
Mon, 03 October 2011 09:08  |
Eclipse User |
|
|
|
Sorry for the delay. I did not see your reply.
The get/set methods have no side effects. I have been using Lombok to generate them, but when this bug came up I coded the get/set methods directly for the affected fields, but that made no difference.
However, I have found a workaround. In the method containing the lines of code which brought on the error, there was a try catch block catching a javax.naming.NamingException. I removed the try catch and caught the exception at a higher level. That stopped the error.
As I have said, this method was not called at all in my testing, but it's presence in the entity class was causing EclipseLink to fail detection of a change to a field.
I'm satisfied this is a bug in the EclipseLink version in Glassfish 3.1.1. What I need to do is put together a simple reproducible test case that someone else can run to verify it.
|
|
|
Powered by
FUDForum. Page generated in 0.04640 seconds