Sven van ´t Veer wrote:
>
> Evan Ireland wrote:
>
> > How about omitting the column from your insert statement, i.e. instead of:
> >
> >    insert into table (myKey, myColWithDefault) values (123, null)
> >
> > do:
> >
> >    insert into table (myKey) values (123)
> >
> > If you are using CMP you will need to check with BEA whether this is possible.
>
> You can´t with bea or with any app server afik. Persistence with CMP is
> completely based on the public fields of the bean. If the table does not
> accept a null value and you try to insert null values an sql exception
> will be thrown. There is no way to adapt the SQL generated to do the
> insert into the table.

Who knows. Your app. server vendor just might allow you to avoid '?' in the
generated SQL when it knows the column doesn't accept nulls.

> The best way to do CMP with default values is to set the fields in the
> ejbCreate method to their default values. You could create environment
> entries for these default values so thei can be changed upon deployment.
>
> sven
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

--
________________________________________________________________________________

Evan Ireland              Sybase EAServer Engineering        [EMAIL PROTECTED]
                            Wellington, New Zealand               +64 4 934-5856

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to