We're updating the issue view to help you get more done. 

ConstraintViolationException not showing constraint name for MySQL

Description

This is my first Hibernate issue ticket so apologies if the format is not ideal.

I have an Hibernate application that works against PostgreSQL 9.1 and when I attempted to test it against a MySQL database I hit a minor issue where ConstraintViolationException exceptions do not have the constraint name populated.

Looking at the PostgreSQL81Dialect and the MySQL5Dialect, it appears that the MySQL5Dialect is missing a ViolatedConstraintNameExtracter.

I created a small workaround dialect class that extends MySQL5Dialect and adds a simple ViolatedConstraintNameExtracter. It is pretty basic but works for my use case.

It would be nice if someone, who knows more about MySQL, could take a look at it and possibly include the necessary to MySQL5Dialect at some point.

I have attached my class for review.

Environment

hibernate-core 4.1.12.Final
MySQL Ver 14.14 Distrib 5.5.31
jdk1.6.0_35

Status

Assignee

Brett Meyer

Reporter

Justin Subert

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.1.12

Priority

Minor