cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: CreateIfNoSchema vs ThrowOnPartialOrCreate strategy
Date Tue, 06 Dec 2011 01:04:04 GMT
Yes, a familiar problem - SchemaUpdateStrategy is defined as a Java class with no extra configuration
options, so each configuration set has to be encapsulated in a separate class. The chosen
defaults for each bundled strategy may not be appropriate for every user. And if you want
a custom variety of a standard strategy, you have to subclass.

In 3.1 it is possible to bind the strategy via DI (so Modeler configuration is something of
a legacy), and this gives users more flexibility in writing strategies. Maybe we at Cayenne
should take another look at the existing strategies and provide configuration options to them
that would reduce the need for subclassing.


On Nov 25, 2011, at 6:12 AM, Tomas Stenlund wrote:

> Hi Jörg,
> I have had exactly the same reflection and I think I have seen different versions of
the same schema strategy where the
> behaviour have been changed between version (setShouldCreateFKConstrants, etc. from false
to true or the other way around).
> I actually though it was intended so I wrote my own strategy instead so I have full control
of it.
> Cheers,
> Tomas
> On 11/25/2011 09:57 AM, Schönfisch, Jörg wrote:
>> Hi,
>> I wanted to change the schema update strategy in my project from CreateIfNoSchema
to ThrowOnPartialOrCreate, but I noticed that the later does not create any PK or FK constraints.
By looking at the code for generate(DataNode) this seems to be intende, but why? Shouldn't
these strategies behave the same way if no schema is present?
>> Cheers,
>> Joerg

View raw message