Best practice for Date in CMP Beans
ivylim Nov 24, 2002 4:49 AMHi people,
My current env is JBoss 3.0 on Windows 2000 with Oracle 8i thin JDBC.
My simple CMP bean (used in the Quick Start Guide template) works provided I removed the java.sql.Date attribute. Here's the code: -
/**
* @return Returns the creation date of this TestEntity
*
* @ejb:persistent-field
*
* @jboss:column-name name="Creation_Date"
**/
public abstract java.sql.Date getCreationDate();
/**
* Specify the creation date of this TestEntity
*
* @param pCreationDate Date of the creation of this TestEntity
**/
public abstract void setCreationDate( java.sql.Date pCreationDate );
Here's the exception:-
15:50:15,118 ERROR [MainDeployer] could not start deployment: file:/D:/jboss-3.0.0_tomcat-4.0.3/serv
er/default/deploy/ejb-test.jar
org.jboss.deployment.DeploymentException: Could not deploy file:/D:/jboss-3.0.0_tomcat-4.0.3/server/
default/deploy/ejb-test.jar; - nested throwable: (org.jboss.deployment.DeploymentException: Error wh
ile creating table; - nested throwable: (java.sql.SQLException: ORA-00902: invalid datatype
))
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:413)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:678)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:513)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:481)
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy4.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:515)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploym
entScanner.java:202)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeployme
ntScanner.java:191)
+ nested throwable:
org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.
SQLException: ORA-00902: invalid datatype
)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:190)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:84)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:383)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
....
HOWEVER, if I use java.util.Date, it works! Is this a bug with Oracle thin JDBC, JBoss, or is it something that I can do?
What's the best practice for date/time attribute anyway?
Thank you.