|
I seem to be unable to use a CMP bean that has
persistent fields of type java.util.Calendar with a mySQL database. (I am using
XDoclet to generate the bean). I can create the bean class and deploy it okay
and the table is created with the correct SQL columns. But when I try to create
an instance of the bean I get a ClassCastException (see below). I can use a
java.util.Date okay but I'm trying to integrate the bean with an Axis service
which requires Calendar not Date.
I converted the fields to dates and tried to create extra methods in the bean that take/return a calendar object and set/get the date fields but this causes the value objects to fail at compilation as the data object doesn't contain all the methods. Besides I would prefer not to have an extra layer converting between date & calendar. Does anyone have any suggestions? 2003-06-08 13:05:14,795 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException, causedBy: javax.ejb.CreateException: Could not create entity:javax.ejb.EJBException: Internal error setting parameters for field test; CausedByException is: Cannot convert class java.util.GregorianCalendar to SQL type requested due to java.lang.ClassCastException - null at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractVendorCreateCommand.insertEntity(JDBCAbstractVendorCreateCommand.java:136) at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractVendorCreateCommand.execute(JDBCAbstractVendorCreateCommand.java:76) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:569) at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:225) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270) at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:571) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:91) at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61) at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92) at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93) at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:477) at org.jboss.ejb.Container.invoke(Container.java:694) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:272) at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110) at $Proxy40.create(Unknown Source) at com.incito.mirror.ejb.TicketMasterBean.issue(TicketMasterBean.java:100) at com.incito.mirror.ejb.TicketMasterBean.issue(TicketMasterBean.java:61) <snipped/> |
- Re: [JBoss-user] Using java.util.Calendar with CMP Colin McFarlane
- Re: [JBoss-user] Using java.util.Calendar with CM... Alexey Loubyansky
- Re[2]: [JBoss-user] Using java.util.Calendar ... Alexey Loubyansky
- Re: [JBoss-user] Using java.util.Calendar with CM... Jonathan . O'Connor
- Re: [JBoss-user] Using java.util.Calendar with CM... Colin McFarlane
