Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1rc2/Annotations 3.1beta6
Mapping documents:
public enum AllocationStatus implements StringValuedEnum {
UNALLOCATED("Unallocated"),
ALLOCATED("Allocated"),
SPLIT("Split"),
MERGED("Merged"),
MERGED_AND_SPLIT("Merged/Split"),
REJECTED("Rejected"),
//Values used for displaying in ComboBoxes
ALL("All"),
ALL_PROCESSED("All Processed");
private final String value;
AllocationStatus(final String value) {
this.value = value;
}
public String toString() {
return value;
}
public String getValue() {
return value;
}
}
Code between sessionFactory.openSession() and session.close():
Collection giveUps = query.getExecutableCriteria(session)
.setFetchMode("splits", FetchMode.JOIN)
.setFetchMode("customerAllocations", FetchMode.JOIN)
.setFetchMode("customerAllocations.allocation", FetchMode.JOIN)
.list();
Full stack trace of any exception that occurs:
java.lang.IllegalArgumentException: Unknown name value for enum class com.acme.busobj.enums.AllocationStatus: Rejected
at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:107)
at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:104)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1898)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1483)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
at com.acme.giveup.PulseGiveUpListener.onMsg(PulseGiveUpListener.java:129)
at com.tibco.tibrv.TibrvEvent.invoke(TibrvEvent.java:160)
at com.tibco.tibrv.TibrvImplQueueC.natTimedDispatch(Native Method)
at com.tibco.tibrv.TibrvImplQueueC.timedDispatch(TibrvImplQueueC.java:48)
at com.tibco.tibrv.TibrvQueue.timedDispatch(TibrvQueue.java:322)
at com.acme.rvutil.rvSubjectGroup.run(rvSubjectGroup.java:88)
at com.acme.rvutil.rvSubjectGroup$QueueDispatcher.run(rvSubjectGroup.java:239
) Caused by: java.lang.IllegalArgumentException: No enum const class com.acme.busobj.enums.AllocationStatus.Rejected
at java.lang.Enum.valueOf(Enum.java:192) at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:104)
... 22 more
Name and version of the database you are using: Sybase 12
I am using StringValuedEnum as defined in
http://www.hibernate.org/273.html. The same code works under hibernate 3.05 with annotations 3.0beta2.