I'm using JBOSS 3.2.1 with MySQL and I'm trying to
write my first XDoclet CMP bean. I cannot get it to
work, though I feel I'm very close. I'm sure that I'm
simply not using the correct tags.

Here is the table definition:

CREATE TABLE foo(
  id int(8) NOT NULL auto_increment,
  name varchar(32) NOT NULL default '',
  PRIMARY KEY (id)
) TYPE=MyISAM;

insert into foo values (0, 'One');
insert into foo values (0, 'Two');

Here is my CMP bean:

package com.helplab;

import javax.ejb.*;

/**
 * @ejb.bean  name="Test"
 *      type="CMP"
 *  jndi-name="ejb/testcmp"
 *
 *      @jboss:table-name table-name="foo"
 *
 *      @ejb.finder
 *    method-intf="Home"
 *    query="SELECT DISTINCT OBJECT(o) FROM Test o
WHERE o.id = ?1"
 *    result-type-mapping="Remote"
 *    signature="java.util.Collection findById(int
id)"
 *
 *       @ejb.finder
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Test o
WHERE o.id = ?1"
 *    result-type-mapping="Local"
 *    signature="java.util.Collection findById(int
id)"
 *
 *      @jboss.query
 *    query="SELECT DISTINCT OBJECT(o) FROM Test o
WHERE o.name = ?1"
 *    signature="java.util.Collection
ejbSelectByName(java.lang.String name)"
 *
 *      @ejb.value-object
 *     match="*"
 *     name="TestVO
 *
 *  @jboss-unknown-pk
 *      class="java.lang.Integer"
 *      column-name="id"
 *      jdbc-type="INTEGER"
 *      sql-type="INTEGER"
 *      auto-increment="true"
 *
 */

public abstract class RegisterBean extends
BaseEntityBean implements EntityBean {
        /**
         *
         * @ejb.pk-field
         *
         * @ejb.persistent-field
         *
         * @ejb.interface-method
         *
         * @ejb.persistence column-name="id"
         *
         * @jboss.auto-increment
         *
         * @jboss:column-name id
         */
        public abstract Integer getId();

        /**
         * No XDoclet tags needed for this method
         */
        public abstract void setId(Integer id);

        /**
         *
         *
         * @ejb.persistent-field
         * @ejb.interface-method
         *
         * @ejb.persistence column-name="name"
         */
        public abstract String getName();


        /**
         * Sets the new name for this record
         *
         * @ejb.persistent-field
         * @ejb.interface-method
         *
         * @ejb.persistence column-name="name"
         */
        public abstract void setName(String name);

        public abstract java.util.Collection
ejbSelectByName(java.lang.String name) throws
FinderException;

        /**
         *
         * @ejb.interface-method
         * view-type="both"
         *
         **/
        public java.util.Collection byName(String name)
throws FinderException {
                return (this.ejbSelectByName(name));
        }


        /**
         * Create record.
         *
         * @ejb.create-method
         *
         */

        public com.helplab.TestPK ejbCreate(String name)
throws javax.ejb.CreateException {
                this.setName(name);
                return null;
        }

        /**
         * Create record.
         *
         */
        public void ejbPostCreate(String name) throws
CreateException {
        }
}


And finally (for those of you that have stuck with me
this far), here is the topmost part of the
stack-trace:

18:01:28,038 INFO  [EJBDeployer] Deployed:
file:/C:/jboss-3.2.1/server/default/d
eploy/firstCmp.jar
18:01:28,058 INFO  [MainDeployer] Deployed package:
file:/C:/jboss-3.2.1/server/
default/deploy/firstCmp.jar
18:01:30,411 ERROR [SubscribingInterceptor] could not
get AbstractReplicatedStor
e
18:01:30,451 ERROR [LogInterceptor] RuntimeException:
java.lang.NullPointerException
        at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityC
ontainer.java:994)
        at
org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercep
tor.java:88)
        at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Ent
itySynchronizationInterceptor.java:188)
        at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
keHome(CachedConnectionInterceptor.java:215)
        at
org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercep
tor.java:88)


Any help would be greatly appreciated!

- Jeff Davies

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to