cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: SQL domain types in Cayenne
Date Sun, 18 Jan 2009 11:47:04 GMT
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
>
>


Mime
View raw message