Also, the default value can be left in the database for documentation
and non-ORM purposes, but that column should be definitely be flagged as
Not Null in Cayenne Modeler and a default value assigned in the Java
class. This is how ORMs (not just Cayenne) expect to function.
From: Mike Kienenberger [mailto:mkienen..mail.com]
Sent: Sunday, March 12, 2006 4:25 PM
Subject: Re: violates not-null constraint question.
On 3/12/06, Joshua Pyle <joshua.t.pyl..mail.com> wrote:
> Mike makes a point that I had trouble seeing when I first started
> using ORM's. In order to use the default values the ORM would havre
> the object and then read it evry time and insert or update was
> performed. This would cause slowdown and inefficiency.
> In the end default database values and an ORM just don't mix.
And it's not like I came up with this brilliant thought on my own
either -- I also thought I should be able to use DB default values
when I first started using ORMs. I also had to have it explained to
me as well :) The same thing applies to auto-increment db-side
generated primary key values, although Andrus (and others) have worked
out the methodology to "read-back" that db-side generated value.
This archive was generated by hypermail 2.0.0 : Mon Mar 13 2006 - 09:07:17 EST