I am trying to insert a USER record in database and leaving the role field empty though my role field references ROLE.ROLE_ID. While creating the User I will not have Role information. I am using Hibernate 3.0 with annotations and it is throwing error when I leave USER.ROLE_ID field empty.
Is there a way to leave foreign key blank/insert null values in it?
When you say you are leaving the roleid empty. Can you show us the INSERT statement that you executed. This should work. I suspect that instead of it being a NULL you are inserting some value which forces it to validate against the ROLE table.