k***@keysolutions.com
2003-01-09 18:28:10 UTC
If you set guid="false" in middlegen's cmp20 tag, you can turn off
automatic primary key generation (what I was trying to do w/ my
Users simple sample. However, the method to instantiate an EJB is
wrong doesn't include the primary key in the method:
public java.lang.String ejbCreate( java.lang.String password,
java.lang.String accessLevel, java.lang.String email )
In this case, it should have included username which was my primary
key.
On the Struts "new user" form that is automatically generated, I see a
username,
password, and email. However, when you put text in username and
password, you'll
see this on your J2EE server (I'm using JBoss):
at java.lang.Thread.run(Thread.java:536)
14:55:11,359 ERROR [Engine] ActionServlet: Create error
javax.ejb.CreateException: Could not create
entity:java.sql.SQLException: Try to
insert null into a non-nullable column in statement [INSERT INTO
USERS (Usernam
e, Password, AccessLevel, Email) VALUES (NULL, 'pw', '', '')]
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(J
DBCCreateEntityCommand.java:199)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCr
eateEntityCommand.java:131)
You can see that the INSERT statement is missing the username field
which is
the primary key.
I'll file this as a bug as well. Just wanted to let folks know in
case they
try something like this.
ken
automatic primary key generation (what I was trying to do w/ my
Users simple sample. However, the method to instantiate an EJB is
wrong doesn't include the primary key in the method:
public java.lang.String ejbCreate( java.lang.String password,
java.lang.String accessLevel, java.lang.String email )
In this case, it should have included username which was my primary
key.
On the Struts "new user" form that is automatically generated, I see a
username,
password, and email. However, when you put text in username and
password, you'll
see this on your J2EE server (I'm using JBoss):
at java.lang.Thread.run(Thread.java:536)
14:55:11,359 ERROR [Engine] ActionServlet: Create error
javax.ejb.CreateException: Could not create
entity:java.sql.SQLException: Try to
insert null into a non-nullable column in statement [INSERT INTO
USERS (Usernam
e, Password, AccessLevel, Email) VALUES (NULL, 'pw', '', '')]
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(J
DBCCreateEntityCommand.java:199)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCr
eateEntityCommand.java:131)
You can see that the INSERT statement is missing the username field
which is
the primary key.
I'll file this as a bug as well. Just wanted to let folks know in
case they
try something like this.
ken