Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SequenceGenerator and schema
SequenceGenerator and schema [message #516239] Tue, 23 February 2010 10:24 Go to next message
Enrico is currently offline EnricoFriend
Messages: 82
Registered: July 2009
Member
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 18:58 Go to previous messageGo to next message
Doug Clarke is currently offline Doug ClarkeFriend
Messages: 155
Registered: July 2009
Senior Member
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] Wed, 24 February 2010 04:20 Go to previous messageGo to next message
Enrico is currently offline EnricoFriend
Messages: 82
Registered: July 2009
Member
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 08:48 Go to previous messageGo to next message
Enrico is currently offline EnricoFriend
Messages: 82
Registered: July 2009
Member
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 20:20 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.


James : Wiki : Book : Blog : Twitter
Previous Topic:Question regarding JPA Joins and predicates
Next Topic:preUpdateWithChanges
Goto Forum:
  


Current Time: Tue Dec 23 02:29:38 GMT 2014

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

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