I have a SLSB method that I call from a portlet. I am trying to create an entity and also modify a many-to-many relationship.
The exception I'm getting is:
20:51:46,215 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
20:51:46,216 ERROR [JDBCExceptionReporter] failed batch
20:51:46,217 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
The SLSB method code is:
Client client = new ClientEJB(username, password, domainName); Role userRole = RoleEJB.findByName(em, "user"); client.getRoles().add(userRole); em.persist(client);