*
The moose likes Object Relational Mapping and the fly likes ClassCastException thrown using @Inheritance and List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "ClassCastException thrown using @Inheritance and List" Watch "ClassCastException thrown using @Inheritance and List" New topic
Author

ClassCastException thrown using @Inheritance and List

Bupjae Lee
Ranch Hand

Joined: May 14, 2007
Posts: 107
(Note: Getter, setter, other methods will be omitted)

First, Hand and Storage both have many units but have slight different properties, so I made three entity classes like this.



And, Master (=Player?) can have one Hand and many Storages (plus other properties) so I made this entity class.



The problem is that when I tried get "storages" field and tried to get a Storage, I got this exception.



It seems that "storages" also have Hand entity.

Is my annotation is wrong? or mapping? or is it just some bug?

* Development Environment:
- Windows XP SP3 Home Edition
- Netbeans IDE 6.1
- Glassfish V2
- Toplink (default entity manager of Glassfish V2)
[ September 01, 2008: Message edited by: Bupjae Lee ]
John Brennan
Greenhorn

Joined: Sep 03, 2008
Posts: 1
Hi Bupjae Lee,

I seem to have a similar problem!
I have two classes Sipuser and Extension that extend VpbxComponent using InheritanceType.JOINED. I have a fourth class VPBX with collections of both derived classes e.g.:



I know the inheritance works because Sipuser and Extension can populate their tables and the VpbxComponent Table. But When I try to display a JSF linked to VPBX I get the error below. It looks as if the wrong class is being instantiated as the property extnumber belongs to Extension not Sipuser.

Any help is greatly appreciated!


PWC1406: Servlet.service() for servlet Faces Servlet threw exception javax.el.PropertyNotFoundException: The class 'ie.connectit.services.vpbx.Sipuser' does not have the property 'extnumber'. at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547) at javax.el.BeanELResolver.getValue(BeanELResolver.java:249) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64) at com.sun.el.parser.AstValue.getValue(AstValue.java:138) at com.sun.el.parser.AstDeferredExpression.getValue(AstDeferredExpression.java:59) at com.sun.el.parser.AstCompositeExpression.getValue(AstCompositeExpression.java:64) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:206) at javax.faces.component.UIOutput.getValue(UIOutput.java:173) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:279) at com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:307) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271) at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:117) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:271) at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:242) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) at javax.faces.render.Renderer.encodeChildren(Renderer.java:137) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892) at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245) at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

[ September 03, 2008: Message edited by: John Brennan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException thrown using @Inheritance and List
 
Similar Threads
HQL Self Left Outer Join
JPA data retrieval query
Issue while trying to map extended class
EJB & JPA Unexpected Results
JPA - need help with query