From: Stephen W. Gevers <sg3235@ya...> - 2001-05-30 03:09:43
I am using a Postgres database and a table with the following definition:
CREATE TABLE "customer"
"cid" int4 DEFAULT nextval('customer_uid_seq'::text),
PRIMARY KEY ("cid")
Note that the primary key has a default value. I first created a Customer
bean that had a create method that took an int. I was able to specify a
value for the cid field. However, I really want a create method that takes
the name and allows the data base to pick the next value for the cid field.
I changed by ejbCreate method to take a String instead of Integer and set
the name field of my bean to the parameter. I still returned Integer as the
return type. I also changed the ejbPostCreate method to take String and the
home interface to reflect the change. When I did this, I get this error:
Exception is javax.ejb.CreateException: Could not create
entity:java.sql.SQLException: ERROR: ExecAppend: Fail to add null value in
not null attribute cid
How do I write my bean do this?