Top Description Constructors Methods
org.hibernate.exception.spi

public abstract Class TemplatedViolatedConstraintNameExtracter

extends Object
implements ViolatedConstraintNameExtracter
Class Inheritance
All Implemented Interfaces
org.hibernate.exception.spi.ViolatedConstraintNameExtracter
Imports
java.sql.SQLException

Knows how to extract a violated constraint name from an error message based on the fact that the constraint name is templated within the message.
Authors
Steve Ebersole, Brett Meyer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract String
public String
extractConstraintName(SQLException
The exception that was the result of the constraint violation.
sqle
)

Implements org.hibernate.exception.spi.ViolatedConstraintNameExtracter.extractConstraintName.

Extract the name of the violated constraint from the given SQLException.
protected String

Returns:

The found constraint name, or null.
extractUsingTemplate
(String
The pattern denoting the start of the constraint name within the message.
templateStart
,
String
The pattern denoting the end of the constraint name within the message.
templateEnd
,
String
The templated error message containing the constraint name.
message
)

Extracts the constraint name based on a template (i.e., templateStartconstraintNametemplateEnd).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TemplatedViolatedConstraintNameExtracterback to summary
public TemplatedViolatedConstraintNameExtracter()

Method Detail

doExtractConstraintNameback to summary
protected abstract String doExtractConstraintName(SQLException sqle) throws NumberFormatException
extractConstraintNameback to summary
public String extractConstraintName(SQLException sqle)

Implements org.hibernate.exception.spi.ViolatedConstraintNameExtracter.extractConstraintName.

Doc from org.hibernate.exception.spi.ViolatedConstraintNameExtracter.extractConstraintName.

Extract the name of the violated constraint from the given SQLException.

Parameters
sqle:SQLException

The exception that was the result of the constraint violation.

Returns:String

The extracted constraint name.

Annotations
@Override
extractUsingTemplateback to summary
protected String extractUsingTemplate(String templateStart, String templateEnd, String message)

Extracts the constraint name based on a template (i.e., templateStartconstraintNametemplateEnd).

Parameters
templateStart:String

The pattern denoting the start of the constraint name within the message.

templateEnd:String

The pattern denoting the end of the constraint name within the message.

message:String

The templated error message containing the constraint name.

Returns:String

The found constraint name, or null.