@Formula with Enum caussing NPE

Description

Hi,

see https://forum.hibernate.org/viewtopic.php?f=1&t=1002718:

@Formula("(my_sql_statement)")
@Type(type="MyEnum")
private MyEnum myField = null;

causes

java.lang.NullPointerException
at org.hibernate.cfg.Ejb3Column.getName(Ejb3Column.java:250)
at org.hibernate.cfg.annotations.SimpleValueBinder.setType(SimpleValueBinder.java:218)
at org.hibernate.cfg.annotations.PropertyBinder.makePropertyAndValue(PropertyBinder.java:185)
...

I think the problem is in the SimpleValueBinder.setType and a simple change should fix this:

  • typeParameters.setProperty( EnumType.COLUMN, columns[0].getName() );
    + typeParameters.setProperty( EnumType.COLUMN, columns[0].getMappingColumn() == null ? null : columns[0].getName() );

Activity

Show:

Brett MeyerJuly 8, 2014 at 3:11 PM

Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!

Brett MeyerApril 7, 2014 at 5:45 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

Ondrej MedekJune 22, 2011 at 12:16 PM

Or maybe what about to fix org.hibernate.mapping.Column.getName() to return the formula when the Column is created from Formula? I see the method Column.getName() is used at more places in the Hibernate code where is may be useful.

Rejected

Details

Assignee

Reporter

Affects versions

Priority

Created June 22, 2011 at 11:04 AM
Updated July 8, 2014 at 3:11 PM
Resolved July 8, 2014 at 3:11 PM