Can't have an @Formula attribute in an @EmbeddedId

Description

If a class that will be used as an embedded id has a column that is defined by an @Formula attribute, hibernate throws a NPE. This is because the below method in org.hibernate.cfg.Ejb3Column doesn't check if the mappingColumn is null (which it is when the column is defined by a formula) before dereferencing it.

public void forceNotNull() {
mappingColumn.setNullable( false );
}

To fix, change the method to:

public void forceNotNull() {
if (mappingColumn != null) {
mappingColumn.setNullable( false );
}
}

Environment

None

Activity

Show:
Out of Date

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

Nicholas White

Affects versions

Priority

Created June 2, 2010 at 12:43 PM
Updated February 14, 2018 at 10:49 AM
Resolved February 14, 2018 at 10:49 AM