Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 91321 invoked from network); 18 Jan 2009 11:47:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jan 2009 11:47:38 -0000 Received: (qmail 80285 invoked by uid 500); 18 Jan 2009 11:47:38 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 80030 invoked by uid 500); 18 Jan 2009 11:47:37 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 80019 invoked by uid 99); 18 Jan 2009 11:47:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Jan 2009 03:47:37 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 18 Jan 2009 11:47:28 +0000 Received: (qmail 24670 invoked from network); 18 Jan 2009 11:47:06 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 18 Jan 2009 11:47:06 -0000 Message-Id: <13C34FE8-7FAC-4DBB-9AAD-A86DCA0453E6@objectstyle.org> From: Andrus Adamchik To: user@cayenne.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: SQL domain types in Cayenne Date: Sun, 18 Jan 2009 13:47:04 +0200 References: X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Hi Steve, Cayenne won't pick up domain types on reverse engineering, but I suspect that whatever type is picked by Cayenne, it will work (i.e. Cayenne will be able to save and load a column value). Trying to see why it can be helpful to have a concept of a domain type in Cayenne. If I understand correctly we are talking about domain types concept as described here for PostgreSQL [1] (you haven't mentioned which DB you are using). So domain type is a constrained base type. Why would you bother to reflect that in Java? Pre-commit validation? Some other reason? BTW, custom types in Java are supported via ExtendedType mechanism [2], but this is mainly used to map custom Java classes, that may not have special corresponding DB constructs (and in 99.9% of cases they don't). You can reuse this mechanism to match your domain types (although manually, as it won't be done by reverse engineering), I am just not sure there's a value in it. I appreciate if you can elaborate on that. Andrus [1] http://www.network-theory.co.uk/docs/postgresql/vol1/CREATEDOMAIN.html [2] http://cayenne.apache.org/doc/extended-types.html On Jan 18, 2009, at 3:15 AM, Stephen Winnall wrote: > Does Cayenne support SQL domain types? I have a schema with a few > CREATE DOMAIN statements in it, and Cayenne seems to have ignored > them when I reverse-engineered the schema. > > My naive expectation was that "CREATE DOMAIN dom AS x" Cayenne would > create a Java class Dom which was a subclass of whatever it > generated for x. > > Steve > >