[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6347) @Formula with Enum caussing NPE

Ondrej Medek (JIRA) noreply at atlassian.com
Wed Jun 22 05:05:53 EDT 2011


@Formula with Enum caussing NPE
-------------------------------

                 Key: HHH-6347
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6347
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.5.3
            Reporter: Ondrej Medek


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() );



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list