You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Ari Maniatis (JIRA)" <ji...@apache.org> on 2009/12/24 05:27:29 UTC

[jira] Closed: (CAY-1345) enum construction requires string name of enum

     [ https://issues.apache.org/jira/browse/CAY-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ari Maniatis closed CAY-1345.
-----------------------------

    Resolution: Fixed

> enum construction requires string name of enum
> ----------------------------------------------
>
>                 Key: CAY-1345
>                 URL: https://issues.apache.org/jira/browse/CAY-1345
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 3.0M6
>            Reporter: Marcin Skladaniec
>            Assignee: Ari Maniatis
>             Fix For: 3.0 beta 2
>
>
> In our setup we are using an int column as a column designator (called 'type').
> this column is then mapped into an enum (called ProductType).
> when creating new objects following stacktrace is created:
>      [java] org.apache.cayenne.CayenneRuntimeException: [v.3.0B1 Nov 03 2009 19:16:06] Error setting property segment 'type' in path 'type'
>      [java] 	at org.apache.cayenne.reflect.PropertyUtils.setProperty(PropertyUtils.java:169)
>      [java] 	at org.apache.cayenne.exp.parser.ASTObjPath.injectValue(ASTObjPath.java:97)
>      [java] 	at org.apache.cayenne.exp.parser.ASTEqual.injectValue(ASTEqual.java:162)
>      [java] 	at org.apache.cayenne.BaseContext.injectInitialValue(BaseContext.java:407)
>      [java] 	at org.apache.cayenne.CayenneContext.registerNewObject(CayenneContext.java:540)
>      [java] 	at org.apache.cayenne.CayenneContext.newObject(CayenneContext.java:349)
>      [java] 	at ish.oncourse.cayenne.CayenneContext.newObject(CayenneContext.java:279)
>      [java] 	at ish.oncourse.cayenne.CayenneContext.newObject(CayenneContext.java:32)
>      [java] 	at ish.oncourse.controller.ControllerFactory.createEditController(ControllerFactory.java:112)
>      [java] 	at ish.oncourse.controller.ControllerFactory.createEditController(ControllerFactory.java:93)
>      [java] 	at ish.oncourse.controller.ControllerFactory.createEditController(ControllerFactory.java:134)
>      [java] 	at ish.oncourse.controller.entity.ProductListController.newRecord(ProductListController.java:76)
>      [java] 	at ish.oncourse.controller.ListController$3.execute(ListController.java:1312)
>      [java] 	at ish.oncourse.actions.PermissibleAction.actionPerformed(PermissibleAction.java:101)
>      [java] 	at ish.view.components.Button.fireActionPerformed(Button.java:189)
>      [java] 	at ish.view.components.Button.actionPerformed(Button.java:166)
>      [java] 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
>      [java] 	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
>      [java] 	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
>      [java] 	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
>      [java] 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
>      [java] 	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
>      [java] 	at java.awt.Component.processMouseEvent(Component.java:6348)
>      [java] 	at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
>      [java] 	at java.awt.Component.processEvent(Component.java:6113)
>      [java] 	at java.awt.Container.processEvent(Container.java:2085)
>      [java] 	at java.awt.Component.dispatchEventImpl(Component.java:4714)
>      [java] 	at java.awt.Container.dispatchEventImpl(Container.java:2143)
>      [java] 	at java.awt.Component.dispatchEvent(Component.java:4544)
>      [java] 	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
>      [java] 	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
>      [java] 	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
>      [java] 	at java.awt.Container.dispatchEventImpl(Container.java:2129)
>      [java] 	at java.awt.Window.dispatchEventImpl(Window.java:2475)
>      [java] 	at java.awt.Component.dispatchEvent(Component.java:4544)
>      [java] 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
>      [java] 	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>      [java] 	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>      [java] 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>      [java] 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>      [java] 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>      [java] 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>      [java] Caused by: java.lang.IllegalArgumentException: No enum const class ish.oncourse.cayenne.ProductType.2
>      [java] 	at java.lang.Enum.valueOf(Enum.java:196)
>      [java] 	at org.apache.cayenne.reflect.EnumConverter.convert(EnumConverter.java:35)
>      [java] 	at org.apache.cayenne.reflect.PropertyUtils.setSimpleProperty(PropertyUtils.java:229)
>      [java] 	at org.apache.cayenne.reflect.PropertyUtils.setProperty(PropertyUtils.java:166)
>      [java] 	... 41 more
> there is a simple workaround, invoking setType(ProductType.MEMBERSHIP) on the new object fixes the problem. Yet it will be nice if the underlying cayenne mechanism worked with enums/int columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.