1 Reply Latest reply on May 13, 2004 9:32 PM by gavin9

    problems with @jboss.persistence auto-increment

    gavin9

      Not sure whether to post here or there.

      I'm using the wonderful JBoss IDE 1.2.3 with eclipse 2.1.3

      I've got a CMP bean that I want to have an auto-increment pk. Sadly the JBoss server spits when I deploy:

      ObjectName: jboss.j2ee:jndiName=helpdesk/JobTicket,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Invalid XML: file=jar:file:/usr/local/jboss3.2/server/default/tmp/deploy/tmp55669helpdesk.jar!/META-INF/jbosscmp-jdbc.xml,

      When I remove the auto-increment xdoclet tag from the bean, JBoss is happy to deploy it. The only difference in the xdoclet output is the <auto-increment/> tag in jbosscmp-jdbc.xml

      Any pointers to getting around this problem greatly appreciated.

      TIA
      Gavin

        • 1. PostgreSQL + auto-increment + SERIAL + xdoclet
          gavin9

          my problem was in fact using the "Version 3.0" instead of "Version 3.2" in the xdoclet configuration. My bad.

          Anyways after wrestling with auto-increment and postgresql I will post my source here, because there are far too few examples to be found.

          /*
           * Created on 13/05/2004
           */
          package com.wt.helpdesk.ejb;
          
          import java.rmi.*;
          
          import javax.ejb.*;
          
          /**
           * @author glang
           *
           * @ejb.bean
           * name = "JobTicket"
           * display-name = "JobTicket"
           * view-type = "local"
           * type = "CMP"
           * cmp-version = "2.x"
           * local-jndi-name = "helpdesk/JobTicket"
           * reentrant = "false"
           * schema = "JobTicket"
           * @ejb.pk
           * class = "java.lang.Object"
           *
           * @jboss.persistence
           * remove-table = "true"
           * table-name = "JobTicket"
           * @jboss.unknown-pk
           * class = "java.lang.Integer"
           * column-name = "ID"
           * jdbc-type = "INTEGER"
           * sql-type = "SERIAL"
           * auto-increment = "true"
           * @jboss.entity-command
           * name = "postgresql-fetch-seq"
           */
          public abstract class JobTicket implements EntityBean {
           /**
           * @ejb.create-method
           * @ejb.interface-method
           */
           public Object ejbCreate(String summary) throws CreateException {
           setSummary(summary);
           return null;
           }
          
           /**
           * @ejb.persistence
           * column-name = "SUMMARY"
           * jdbc-type = "VARCHAR"
           * sql-type = "varchar(50)"
           * @ejb.interface-method
           */
           public abstract String getSummary();
           /**
           * @ejb.interface-method
           */
           public abstract void setSummary(String desc);
          
           public void ejbActivate() throws EJBException, RemoteException {}
           public void ejbLoad() throws EJBException, RemoteException {}
           public void ejbPassivate() throws EJBException, RemoteException {}
           public void ejbRemove()
           throws RemoveException, EJBException, RemoteException {}
           public void ejbStore() throws EJBException, RemoteException {}
           public void setEntityContext(EntityContext arg0)
           throws EJBException, RemoteException {}
           public void unsetEntityContext() throws EJBException, RemoteException {}
          }