I have two entities, ComponentMetaData and ComponentType.
ComponentMetaData.class
ComponentType.class
Now when I am trying to persist the ComponentMetaData Object. It is throwing Transaction RollBack Exception.
Because it also tries to run an insert query in ComponentType table (Which of course it will not be able to do) .. As it will generate duplicate primary key entry...
This is how I am persisting...
I have attached my table structure...
Can anyone see, where I am doing anything wrong...
I doubt if I have done the Foreign Key Mapping in the component_meta_data class correct or not..
And anyways, the problem is now resolved.. Thanks for your reply..
Actually the problem was of MySQL Engine. (It was MyISAM and it does not support Foreign Key.. Need to enable InnoDB).
Due to this I was able to insert a value for foreign key which was not in primary key column of ComponentType..