db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Dudziak" <tom...@gmail.com>
Subject Re: hashCode and database equality
Date Mon, 06 Mar 2006 19:21:46 GMT
On 3/6/06, Arbogast S├ębastien <sarbogast@axen.info> wrote:

> Am I right to assume that if two databases have the same structure (and only if so),
then they will have the same hashCode ? Can I rely on that ?

Mhmm, this depends on what is meant by 'same structure'. E.g. possible
problems are:

* DdlUtils automatically generates a foreign key name if none is
specified. So, are a foreign key without a name and one with a name
equal ?

* The platform can operate in delimited identifier mode (where the
case of identifiers matters) or in normal mode (where the case does
not matter). Since the model is operation-independent, it is
impossible for equals/hashCode to work correctly in both modes.

That being said, the model implements equals/hashCode for delimited
identifier mode and assumes that there is always a name.
But in the long run, you're probably better off implementing your own
hashCode. Just have a look at how the model does it and implement a
Visitor for your mode. If it is not too urgent, then you could also
add a feature request to JIRA and we can include it in the 1.1.

Tom

Mime
View raw message