[jboss-user] [JBoss Seam] - Elegant handling of foreign key constraints

pdhaigh do-not-reply at jboss.com
Mon Oct 8 09:00:47 EDT 2007


Hi,

Is there an elegant way of handling a delete that fails due to a foreign key constraint?

	@Transactional
  | 	public String remove()
  | 	{
  | 		try
  | 		{
  | 			return super.remove();
  | 		}
  | 		catch (EntityExistsException ve)
  | 		{
  | 			log.warn("Caught entity exists exception");
  | 			return "removed";
  | 		}
  | }

Allows me to catch the EntityExistsException, but I cannot directly catch ConstraintViolationException. (which is still logged as an error by AbstractFlushingEventListener).

cheers

phil

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

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



More information about the jboss-user mailing list