I have been struggling for hours now with this really surprising issue. I never had problems with this sort of things. Classes involved are Proveedor (Supplier) and ComercialOfertas (Commercial). This is a OneToOne relationship:
getters/setters are compliant with JavaBeans notations and column names are fully correct in the database. I also check that both references are set correctly at the time of saving, and they are.
Currently this is done in a dev stage of my project and I can remember saving such instances with no problem. Now this is arising for some reason.
Have tried as well by catching the exception and digging down the exception information trying to clue something out. But have had no luck.
Would very much appreciate if anyone sees anything which may be disturbing the process.
Thank you very much.
Joined: Apr 21, 2010
Solved, but the problem was not this relationship, but another ManyToMany relationship between ComercialOfertas and another class in my domain. However the exception was arosen from ComercialOfertas. That was what drove me mad.
After enabling show_sql I saw something was wrong there, then the sql stats stopped when trying to insert records in the join table describing that manytomany relationship. The answer was to cascade (as usual with this type of exception) from one entity to another. The whole point is that the true error got masked and was very difficult to see.