We're updating the issue view to help you get more done. 

@Formula of enum type results in ClassCastException

Description

1 2 3 @Formula("(select 'A' from dual)") @Enumerated(EnumType.STRING) private Trimmed formula;

results in:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 java.lang.ClassCastException: org.hibernate.mapping.Formula cannot be cast to org.hibernate.mapping.Column at org.hibernate.mapping.SimpleValue.createParameterImpl(SimpleValue.java:499) at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:324) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) at org.hibernate.mapping.Property.isValid(Property.java:241) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.hibernate.testing.junit4.TestClassMetadata.performCallbackInvocation(TestClassMetadata.java:205) ... 15 more

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Andreas Berger

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.6
4.2.15

Priority

Major