Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » SequenceGenerator and schema
SequenceGenerator and schema [message #516239] Tue, 23 February 2010 05:24 Go to next message
Eclipse UserFriend
Dear all,

I set the database schema name into orm.xml file.
Table entity are created into the schema but sequence (I use
@SequenceGenerator statement) are created into default "public" schema
(Postgres).

I would like to now how I can set also the schema name for sequences
generate by the @SequenceGenerator statement. I need to solve this
becase i have different projects that work on the same DB but on
different schema names. This project have also same entity classes
(therefore same sequence generator name), so now they all use the
sequence defined into the "public" schema. I would like that a project
use its sequence defined into its schema.

BR,
Enrico
Re: SequenceGenerator and schema [message #516372 is a reply to message #516239] Tue, 23 February 2010 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Enrico,

Have you set the schema attribute in the @SequenceGenerator?

@SequenceGenerator(name="ADDRESS_SEQ", schema="SCHEMA1", allocationSize=25)


Doug
Re: SequenceGenerator and schema [message #516501 is a reply to message #516372] Tue, 23 February 2010 23:20 Go to previous messageGo to next message
Eclipse UserFriend
HI Doug,

thank you for your reply.
I tried but a compile error occuour:

"The attribute schema is undefined for the annotation type
SequenceGenerator"

I am using Java Persistence 1.0.

Anyway, I would like also to know if it is possible to set the schema
name only in one point and not on all entity class. In particular I
would like to get the schema name always from the orm.xml file.

Because if I set the schema name in the entity class I need every time
to recompile the class if I need to use the same class for another
project (e.g. two context that use same classes and same DB but on
different schema names). I now I can configure any entity on xml file
but I would like to now if I can get the shema names also for sequences
from the orm.xml file.

BR,
Enrico




Doug Clarke ha scritto:
> Enrico,
>
> Have you set the schema attribute in the @SequenceGenerator?
>
> @SequenceGenerator(name="ADDRESS_SEQ", schema="SCHEMA1", allocationSize=25)
>
>
> Doug
Re: SequenceGenerator and schema [message #517536 is a reply to message #516501] Mon, 01 March 2010 03:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

any help about my issue?
Simple I would like to get the schema name for Sequence from orm.xml!
Is it possible?

Otherwise, I think the best solution is to convert my SequenceGenerator
into TableGenerator, in order to have the table in the Schema name
specified on the orm.xml file!

BR,
Enrico

So, for example:

Enrico ha scritto:
> HI Doug,
>
> thank you for your reply.
> I tried but a compile error occuour:
>
> "The attribute schema is undefined for the annotation type
> SequenceGenerator"
>
> I am using Java Persistence 1.0.
>
> Anyway, I would like also to know if it is possible to set the schema
> name only in one point and not on all entity class. In particular I
> would like to get the schema name always from the orm.xml file.
>
> Because if I set the schema name in the entity class I need every time
> to recompile the class if I need to use the same class for another
> project (e.g. two context that use same classes and same DB but on
> different schema names). I now I can configure any entity on xml file
> but I would like to now if I can get the shema names also for sequences
> from the orm.xml file.
>
> BR,
> Enrico
>
>
>
>
> Doug Clarke ha scritto:
>> Enrico,
>>
>> Have you set the schema attribute in the @SequenceGenerator?
>>
>> @SequenceGenerator(name="ADDRESS_SEQ", schema="SCHEMA1",
>> allocationSize=25)
>>
>>
>> Doug
Re: SequenceGenerator and schema [message #518037 is a reply to message #516239] Tue, 02 March 2010 15:20 Go to previous message
Eclipse UserFriend
There is a tableQualifier on the EclipseLink DatabaseLogin (from Session), you can set this using a SessionCustomizer and it will be set on every table and sequence that has not defined its own qualifier. You can also get each NativeSequence object from the Session's DatabaseLogin and set its qualifier.

We don't currently seem to have a persistence unit property for the tableQualifier (default schema) we should, please log a bug for this.
Previous Topic:Question regarding JPA Joins and predicates
Next Topic:preUpdateWithChanges
Goto Forum:
  


Current Time: Wed Jul 23 09:32:38 EDT 2025

Powered by FUDForum. Page generated in 0.05355 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top