On Thu, 2003-09-25 at 00:07, Kevin Norton wrote:
> I have put in about 3 days worth of struggling to use Xdoclet. Need basic
> beginner help.
>
> I can get my Entity Bean to launch and I can get a handle to the home
> interface by using the generated Util Class. But when I try to call my
> create method I get the following error.
>
> javax.ejb.CreateException: Could not create entity:java.sql.SQLException:
> Column not found: DESC in statement [INSERT INTO ROLES (name, desc,
> comments) VALUES ('Kevin', 'All', 'Everyone')] at
> org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(JDBCCreateEntityCommand.java:199
>
> My Base Bean is as follows. Any pointer and help as to why I'm getting this
> error would be greatly appreciated and have much impact on how much more
> time I put into learning xdoclet.
At a guess, I'd say it's not really an XDoclet problem nor even an EJB
problem, at least not exactly. It looks to me more like a SQL problem -
"desc" is a reserved word (as in "SELECT foo FROM bar ORDER BY bub
DESC"), so I reckon your database is objecting to the SQL that JBoss'
CMP engine has generated for the create method. Try renaming your
field/column to "description" rather than "desc" and see if that works
any better.
Andrew.
> Thanks...
>
> package test.ejb;
>
> import test.interfaces.*;
> import javax.ejb.EntityBean;
> import javax.ejb.CreateException;
>
>
> /**
> * @ejb:bean
> * name="Roles"
> * type="CMP"
> * view-type="local"
> * local-jndi-name="test.interfaces.RolesLocalHome"
> * schema="Roles"
> *
> * @ejb.util generate="physical"
> * @ejb.finder signature="java.util.Collection findAll()"
> * @ejb:value-object name="Roles" match="*"
> *
> */
> public abstract class RolesBean implements EntityBean
> {
>
> /**
> * @ejb.pk-field
> * @ejb.persistent-field
> * @ejb.persistence
> * column-name="NAME"
> * jdbc-type="VARCHAR"
> * sql-type="varchar(255)"
> * @ejb.interface-method
> */
> public abstract String getName();
>
> public abstract void setName(String name);
> /**
> * @ejb:interface-method
> * @ejb:persistent-field
> * @ejb.persistence
> * column-name="desc"
> * jdbc-type="VARCHAR"
> * sql-type="varchar(255)"
> * @jboss.column-name name="desc"
> * @jboss.sql-type type = "varchar(255)"
> * @jboss.jdbc-type type = "VARCHAR"
> */
> public abstract String getDesc();
>
> public abstract void setDesc(String desc);
> /**
> * @ejb:interface-method
> * @ejb:persistent-field
> * @ejb.persistence
> * column-name="comments"
> * jdbc-type="VARCHAR"
> * sql-type="varchar(255)"
> * @jboss.column-name name="comments"
> * @jboss.sql-type type = "varchar(255)"
> * @jboss.jdbc-type type = "VARCHAR"
> */
> public abstract String getComments();
>
> public abstract void setComments(String comments);
>
> /**
> * @ejb.create-method
> */
> public RolesPK ejbCreate(String name,String desc,String comments )
> throws CreateException
> {
> setName(name);
> setDesc(desc);
> setComments(comments);
> return null;
> }
> public void ejbPostCreate(String name,String desc, String comments )
> throws CreateException {}
> }
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user