Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Workaround for Null Default Values

No way that I know of.  You can use a ReturningPolicy to omit an insert field
and select it back, but nothing to omit it only if null.  Perhaps log an
enhancement request.

In general it may be better to initialize the value in Java instead of the
database.  Even if you omit the null, you still don't get the value back
from the database, so your object becomes inconsistent with the database.

You might be able to hack something with a InsertObjectQuery Redirector on
the DescriptorQueryManager, but that would be complicated.

Tim Hollosy wrote:
> This has probably been asked before, but I couldn't find it. Is there
> an easy way to make EclipseLink not include nulls in insert
> statements? As is, it's including the null value, which is causing the
> default value on in oracle to not be set.
> I don't want to use the insertable=false attribute on the @Column
> annotation, because sometimes I want to be able to specify the value.
> Basically I want an attribute that's like, includeWhenNull=false ,
> which when set would cause the column to be left out of the insert
> query.
> I thought nullable=false might take care of it, but it didn't.
> Thanks,
> Tim

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top