Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 48551 invoked from network); 28 Jul 2009 09:21:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Jul 2009 09:21:08 -0000 Received: (qmail 53539 invoked by uid 500); 28 Jul 2009 09:22:25 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 53469 invoked by uid 500); 28 Jul 2009 09:22:25 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 53459 invoked by uid 99); 28 Jul 2009 09:22:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jul 2009 09:22:25 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of Alan.Raison@luminary.co.uk does not designate 69.18.216.40 as permitted sender) Received: from [69.18.216.40] (HELO mail.ingres.com) (69.18.216.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jul 2009 09:22:15 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Generators Date: Tue, 28 Jul 2009 05:20:16 -0400 Message-ID: In-Reply-To: <89c0c52c0907271122i3ef820b0u3e525f29759988db@mail.gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Generators Thread-Index: AcoO50DVd3cCdanyRZKWNdTLbTT/BQAebHNQ References: <89c0c52c0907271122i3ef820b0u3e525f29759988db@mail.gmail.com> From: "Alan Raison" To: X-Virus-Checked: Checked by ClamAV on apache.org Kevin It is true that a field can override the default generation strategy to = use sequences; for example I have the following sequence generator = defined: @SequenceGenerator(name=3D"myseq",sequenceName=3D"my_seq",initialValue=3D= 5) And a field using this generator: = @GeneratedValue(strategy=3DGenerationType.SEQUENCE,generator=3D"myseq") public int getColumn() { ... } This works correctly. However, given the field: @Id @GeneratedValue public int getId() { ... } This will use the OPENJPA_SEQUENCE_TABLE unless a) I specify (strategy=3DGenerationType.SEQUENCE), or b) I set openjpa.Sequence=3Dnative My dictionary does not set sequenceSQL, sequenceSchemaSQL or = sequenceNameSQL, since it wasn't clear what these should return, but I = have set nextSequenceQuery and overridden getSequencesSQL(String, = String) Is the lack of these attributes the cause for GenerationType.TABLE being = the default? Alan=A0 -----Original Message----- From: Kevin Sutter [mailto:kwsutter@gmail.com]=20 Sent: 27 July 2009 19:22 To: dev@openjpa.apache.org Subject: Re: Generators Hi Alan, I wonder if our documentation is in sync with the code... The default = value for openjpa.Sequence is table. But, I believe we override that if = certain attributes within the Dictionary are set. For example, sequenceSQL, sequenceSchemaSQL, and sequenceNameSQL are attributes that get set by = data dictionaries that support Sequences natively. For example, DB2 and = Oracle are two databases that support native sequences. And, as long as the GeneratedValue Strategy is set to SEQUENCE, I believe this kicks in = without having to set openjpa.Sequence to "native". Since you are looking to create a new dictionary for Ingres, this would explain why you have to set the openjpa.Sequence property to get the = desired effect. Can you do any experimentation to verify this? We may need to update = our documentation or javadoc to make this clearer. Kevin On Mon, Jul 27, 2009 at 11:36 AM, Alan Raison = wrote: > Hi all > > I've been looking at the sequence support in DBDictionary and = extending > it for Ingres. Ingres supports native sequences, but it seems that by > default, OpenJPA prefers to use the OPENJPA_SEQUENCE_TABLE for = internal > sequence numbering. Setting openjpa.Sequence=3Dnative changes this to = use > the native sequences. > > Is there a way/would it be desirable to set a preference for native > sequences in the DB Dictionary? I don't see this in any other > dictionary, so I assume it's not desirable. Perhaps this is so the > schema is predictable? > > Thanks > > Alan >