Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] DB2 - unique constraint names too long

Hi Peter,

Since the spec does not specify a way to directly name Unique Constraints, there is no way to do it with JPA API. There are ways to set this up with EclipseLink-specific API, but I suspect that would defeat your use of the DDL generation feature.

The way we tend to support these things is to allow a maximum length for certain constructs in our schema generation. This issue would likely be addressed in the same way as other constructs. (See DB2Platform.getMaxFieldNameSize() and DB2Platform.getMaxForeignKeyNameSize()).

It would be worth entering an enhancement request for this and if you feel like contributing a fix, this is an area of code that is not overly complex, and I'd be happy to help. I'll leave that up to you though.


Peter Szaniszlo wrote:


We plan to use EclipseLink in our project as a JPA platform. Our application must run on Oracle and DB2 databases. We will also use the database object auto generation feature. With ORACLE everything works fine. But under DB2 the names for unique constraints (composed of 2 or more columns) are rejected as too long and the constraints are not created. The constraint is created after manual modification of its name. Unfortunately there is no name attribute in the UniqueConstraint annotation.

Are there any possibilities to solve this problem?

Best Regards,



eclipselink-users mailing list

Back to the top