Quick situation overview - I've got an entity called a PartHolderNode which has a collection of entities called RepositoryItems. I'm trying to add an existing RepositoryItem into an existing PartHolderNode's collection. Instead of a slightly bigger collection, I get an exception stating "Unable to commit". The mapping seems to be correct based on the fact that if I add a new (not persisted) RepositoryItem to a collection and call merge it persists to the database as expected.
Inside a stateless controller bean for PartHolderNodes I had the following method -
manager.persist() has also been tried as manager.merge().
Unfortunately, this results in the following -
The JBoss logs show that it has executed an update to the join table between the two entities, but when it attempts to "close PreparedStatement" it throws the JDBCException stating "Could not execute JDBC batch update".
Surely adding an element to a collection and saving the change to the db should be straightforward? What have I missed this time?!
The relationship between PHN and RIs is mapped as follows -
and the addFile(foo) method in the controller bean just consists of files.add(foo.)
If you need any more detail just let me know.
[ May 17, 2007: Message edited by: Ross Hendry ]