Re: cayenne: firebird generators

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Mar 31 2005 - 21:04:22 EST


Hi Damir,

Feel free to continue this discussion on cayenne-devel [I am cc'ing
reply to the list].

On Mar 29, 2005, at 2:28 PM, Damir Bijuklic wrote:
> I have some questions for discussion and sample
> implementation of firebird generators (sequences) for
> you. I have included modified files in an attachment.

Hmm.. I haven't got any attachments with your message. It would
probably make sense to create a JIRA issue like Mike suggested, and add
your code as an issue attachment. Much easier to track and share with
others...

> 1. firebird generators are implemented, with a
> change of interface so that pkFromDatabase returns
> long instead of int - this change is made in the base
> class which might not be desireable, so we will need
> to create another method (?)

A method with a different name in your PK generator is probably a
better idea... But this got me thinking - return type (int vs. long)
shouldn't really be hardcoded in the PK generator as it enforces (or
assumes) a certain table design... How about we make it smart based on
default JDBC to Java types mapping? JDBC INTEGER corresponds to int,
BIGINT corresponds to long
(http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html).
This kind of logic can probably go into the superclass.

> 2. DataObjectUtils implements new method longPkForObject which returns
> long. Method intPkForObject checks if value returned is integer and
> not long.

No problem with this addition - DataObjectUtils is just that - Utils.
So if you call intPkForObject for a char PK, you'll get an exception.
Same logic will apply in this case.

> 3. It would be nice if cayenne modeler included a setting for default
> initial value of pk generator (it
> is currently hardcoded to 200 in places)

This is pending some refactoring. I agree that it would be nice to
have.. Not that it prevents you from manually setting it, but having it
in the Modeler would be a big plus.

Andrus



This archive was generated by hypermail 2.0.0 : Thu Mar 31 2005 - 21:04:30 EST