As stated previously, it is to do with the data being inserted into the database violating a foreign key constraint.
Joined: Aug 06, 2010
James, it's definitely not a Maven issue... But it might be related to different versions of TopLink... I seem to remember there used to be a bug with TopLink not allowing automatic FK generation, and he's pretty adamant that nothing has changed apparently...
Even so, Amr, first thing I would try is check if you have cascade=PERSIST or ALL set on your relationship. If not, set it. In this case, it cannot have worked before. If it is there, persist the Merchant, flush the EntityManager, and then persist the Store. That ought to work. Your merchant will be in the database, and your FK constraint will not fail. If this fixes it, it might be due to TopLink. If it still doesn't work, you'll definitely have a different error message.
And please, next time post all the relevant code and configs, not just the error message.
Amr k. Saleh
Joined: Aug 23, 2010
ok, i have a Merchant entity that extend User entity
and Merchant entity has a list of store entity
and that is the code that inserts Merchant entity
i logged the generated queries and i found out that it inserts User then Store and that is why it voilate the FK constraint because there is no merchant yet, how can i solve this ?