Creating tables on deploy failed
cgabi Feb 12, 2004 7:04 AMHi,
I'm using xdoclet to generate a CMP bean and I'm getting a strange error when I deploy the bean. I've tryed to clean all, to rebuild all but I'm getting same error all the time.
Below is my bean code:
package net.bitsizecode.bitserver.ejb;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import javax.ejb.CreateException;
/**
* Entity bean that represents the Devices table
* Relation USERS - DEVICES 1..n
*
* @author Gabriel Ciuloaica
* @version [CVS] $Id: DevicesBean.java,v 1.6 2004/02/11 17:35:21 Administrator Exp $
*
* @ejb.bean description="Devices Entity Bean"
* display-name="DevicesBean"
* local-jndi-name="DevicesHomeLocal"
* name="DevicesBean"
* primkey-field="DID"
* type="CMP"
* view-type="local"
* cmp-version = "2.x"
* schema = "DevicesTable"
*
* @ejb.persistence table-name = "DEVICES"
*
* @ejb.util generate = "physical"
*/
public abstract class DevicesBean implements EntityBean {
/**
* Default constructor
*/
public DevicesBean() {
super();
}
/**
* Get the device DID (pk)
*
* @ejb.persistence column-name = "DID"
* jdbc-type = "VARCHAR"
* sql-type = "VARCHAR(255)"
* @ejb.interface-method view-type = "local"
* @ejb.pk-field = "DID"
*
*/
public abstract String getDID();
/**
* Set the divice ID (DID)
* @param DID device id
*
* @ejb.interface-method view-type = "local"
*
*/
public abstract void setDID(String DID);
/**
* Get the user id (fk)
*
* @ejb.persistence column-name = "UID"
* jdbc-type = "VARCHAR"
* sql-type = "VARCHAR(255)"
* @ejb.interface-method view-type = "local"
*
*/
public abstract String getUID();
/**
* Set the user id
* @param UID user id
*
* @ejb.interface-method view-type = "local"
*/
public abstract void setUID(String UID);
/**
* Set/Get the device uri (usually the IMEI)
*
* @ejb.persistence column-name = "URI"
* jdbc-type = "VARCHAR"
* sql-type = "VARCHAR(255)"
* @ejb.interface-method view-type = "local"
*
*/
public abstract String getURI();
/**
* Set the device URI (usually IMEI)
* @param uri the IMEI of the device
*
* @ejb.interface-method view-type = "local"
*/
public abstract void setURI(String uri);
/**
* Get device name (a generic name)
*
* @ejb.persistence column-name = "DEVICENAME"
* jdbc-type = "VARCHAR"
* sql-type = "VARCHAR(255)"
* @ejb.interface-method view-type = "local"
*
*/
public abstract String getDEVICENAME();
/**
* Set device name (a generic name)
* @param DEVICENAME the device name
*
* @ejb.interface-method view-type = "local"
*/
public abstract void setDEVICENAME(String DEVICENAME);
/**
* Create a new record in device table
* @param DID
* @param UID
* @param URI
* @param DEVICENAME
* @throws CreateException
*
* @ejb.create-method view-type = "local"
*/
public String ejbCreate(String DID, String UID, String URI, String DEVICENAME) throws CreateException{
setDID(DID);
setUID(UID);
setURI(URI);
setDEVICENAME(DEVICENAME);
return DID;
}
public void ejbPostCreate(String DID, String UID, String URI, String DEVICENAME) throws CreateException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbLoad()
*/
public void ejbLoad() throws EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbRemove()
*/
public void ejbRemove()
throws RemoveException, EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbStore()
*/
public void ejbStore() throws EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
*/
public void setEntityContext(EntityContext arg0)
throws EJBException, RemoteException {
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#unsetEntityContext()
*/
public void unsetEntityContext() throws EJBException, RemoteException {
}
}
Below is the error that I'm getting on deploy:
14:25:59,257 ERROR [EntityContainer] Starting failed org.jboss.deployment.DeploymentException: Error while creating table DEVICES; - nested throwable: (java.sql.SQLException: Wrong data type: ( in statement [CREATE TABLE DEVICES (DID VARCHAR(255) NOT NULL, UID VARCHAR(255), URI VARCHAR(255), DEVICENAME VARCHAR(255), VARCHAR(255), CONSTRAINT PK_DEVICES PRIMARY KEY (DID))]) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:232) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:93) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:484) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:388) at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152) at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342) at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192) 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.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976) at $Proxy14.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:394) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) at $Proxy58.start(Unknown Source) at org.jboss.ejb.EjbModule.startService(EjbModule.java:331) at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192) 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.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976) at $Proxy14.start(Unknown Source) at org.jboss.system.ServiceController.start(ServiceController.java:394) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) at $Proxy12.start(Unknown Source) at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605) at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177) at $Proxy6.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191) Caused by: java.sql.SQLException: Wrong data type: ( in statement [CREATE TABLE DEVICES (DID VARCHAR(255) NOT NULL, UID VARCHAR(255), URI VARCHAR(255), DEVICENAME VARCHAR(255), VARCHAR(255), CONSTRAINT PK_DEVICES PRIMARY KEY (DID))] at org.hsqldb.Trace.getError(Unknown Source) at org.hsqldb.jdbcResultSet.<init>(Unknown Source) at org.hsqldb.jdbcConnection.executeStandalone(Unknown Source) at org.hsqldb.jdbcConnection.execute(Unknown Source) at org.hsqldb.jdbcStatement.fetchResult(Unknown Source) at org.hsqldb.jdbcStatement.executeUpdate(Unknown Source) at org.jboss.resource.adapter.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:262) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCommand.java:219) ... 57 more
It seems very strange for me. I do not trying to create the fifth element in the bean code and I do not understand how it gets generated.
What could be the problem ?
Thanks,