[jboss-user] [EJB 3.0] - Exception while creating entities in SLSB

cuoz do-not-reply at jboss.com
Mon Aug 28 21:07:34 EDT 2006


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);

If I comment out adding the role, the client entity does get created just fine.

Is there something I need to do in order to persist the new entity with the relationship?  I've tried using em.flush() after creating the entity with no luck.

I'm somewhat new to EJB3, so thanks in advance for any help,
Gary.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967976#3967976

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967976



More information about the jboss-user mailing list