Mike D Pilsbury <mik..ekim.co.uk> wrote:
> I have a column that is defined as having a default value (actually
> CURRENT_TIMESTAMP, but it shouldn't matter). When I create a new object,
> and it gets committed, the generated INSERT sets the column to null. But
> this obviously stops the database from using the default value.
>
> So what I want to know is how do I configure Cayenne so that it ignores
> the column for INSERTs and UPDATEs, but gets it for selects? I tried
> setting the column to Auto (isGenerated), but that appears to have no
> effect. I know that Hibernate supports this. so I don't doubt that
> Cayenne does too.
I can see the advantage of using default values, but I think you should
consider a different strategy.
There must be a way to query what those default values are using SQL.
I recommend reading in any default values on application startup (or more
frequently if you desire), then assigning them as usual thereafter.
It's a little more tricky for a dynamic value like current_timestamp, but
could you make it work by letting the application determine the current
time?
-Mike
This archive was generated by hypermail 2.0.0 : Sun Jan 16 2005 - 17:49:52 EST