A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java Interview Guide
this week in the
EJB and other Java EE Technologies
EJB create not using default value for not null column
Joined: Jan 28, 2005
Jun 13, 2005 03:32:00
I'm having problems getting my
create method to use the default value for a not null column.
This is an ORACLE database and the entity beans are using CMP.
I have a table with a field, say z, that is not null and has a default value specified in the database.
In an ordinary SQL window the following works:
insert into app_orders (x,y) values (9999999, '
There is existing code like this:
order = getOrderHome().create(orderPk,orderNumber);
But when this is executed we get the error:
: Could not create entity:
: ORA-01400: cannot insert NULL into ("XXX"."APP_ORDERS"."Z")
Can we do something to make the EJB use the default value?
Joined: Mar 28, 2005
Jun 13, 2005 16:10:00
create another Create method that takes only the primary key.
and u call that when u detect orderNumber == NULL.
I agree. Here's the link:
subject: EJB create not using default value for not null column
DB default values with CMPs
Primiary Key Field
SQLException:Column count doesn't match value count at row 1
mysql date problem
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015