Discussion:
[Middlegen-user] FYI, guid=false generates invalid INSERT SQL
k***@keysolutions.com
2003-01-09 18:28:10 UTC
Permalink
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
Aslak Hellesoy
2003-01-09 20:23:11 UTC
Permalink
Can you post your <middlegen> task invocation source?

Aslak
-----Original Message-----
Sent: 9. januar 2003 21:30
Subject: [Middlegen-user] FYI, guid=false generates invalid INSERT SQL
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
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
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
-------------------------------------------------------
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
k***@keysolutions.com
2003-01-09 21:01:11 UTC
Permalink
Post by Aslak Hellesoy
Can you post your <middlegen> task invocation source?
I followed up on the bug report to not clutter up the list :-)

http://sourceforge.net/tracker/index.php?func=detail&aid=665279&group_id=36044&atid=415990


ken

Loading...