Adding @NotNull to a @ManyToOne association with @JoinColumnsOrFormulas leads to ClassCastException

Description

Given a mapping like

where Titel is a subtype of a DomainValue:

base class DomainValue

the @NotNull leads to a class cast exception while starting the persistence unit:

Mapping seams to work, though. But i guess the validation isnt't in place.

Environment

Java 7, Spring 3.2

Activity

Show:
Michael Simons
April 11, 2013, 8:26 AM

Could you reproduce the problem? The mapping is somewhat complicated (It's a very legacy scheme you might have guessed) but i could try to extract the problematic classes. Anyway, thanks for looking at it.

Steve Ebersole
April 11, 2013, 5:27 PM

The "error" is really just a warning message:

So, not a bug. I assume what you want instead is for this to be logged in a more descriptive way.

Here, in this particular example, applying the not-null to just the column and ignoring the formula is fine. Still think it should be logged, but I'll log it in a more descriptive way, without the stack.

Michael Simons
April 11, 2013, 5:42 PM

Aaah, i see. Yeah, those who do read have some advantages. "Unable to apply constraints on DDL". So the validator will kick in?
Thanks for clarifying (and i think a better message would be great nevertheless).

Fixed

Assignee

Steve Ebersole

Reporter

Michael Simons

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure