Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 283759

Summary: JPA 2.0 Schema/Catalog on SequenceGenerator
Product: z_Archived Reporter: Andrei Ilitchev <andrei.ilitchev>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: karenfbutzke
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Slightly updated patch none

Description Andrei Ilitchev CLA 2009-07-16 16:37:08 EDT
Currently schema and catalog specified in SequenceGenerater are ignored.
Comment 1 Andrei Ilitchev CLA 2009-07-16 16:55:04 EDT
Created attachment 141821 [details]
Proposed patch

The patch refactors Sequence heirarchy moving attribute qualifier from TableSequence and UnaryTableSequence up to Sequence class.

Before qualifier was copied from platform.tableQualifier.
Now that happens only if qualifier hasn't been explicitly assigned.

SequenceGeneratorMetadata assignes qualifier (catalog.schema) to corresponding NativeSequence object.

NativeSequence passes qualified name to the platforms, platforms no longer qualify the name.

DDL generating SequenceObjectDefinition class uses NativeSequence's qualifier, too.
Comment 2 Andrei Ilitchev CLA 2009-07-17 16:30:32 EDT
Created attachment 141927 [details]
Slightly updated patch

The patch was corrected following Guy's suggestions:

Looks fine, the only thing being the context. You re-used the existing table context which is used with @Table defaulting, meaning your log messages when defaulting any sequence generator will use these log string 

"The table schema for entity [{0}] is being defaulted to: {1}."
"The table catalog for entity [{0}] is being defaulted to: {1}."

I'd create new contexts, it's very simple (3 steps)

1 - Create new statics in MetadataLogger
public static final String SEQUENCE_GENERATOR_SCHEMA = "metadata_default_sequence_generator_schema";
public static final String SEQUENCE_GENERATOR_CATALOG = "metadata_default_sequence_generator_catalog";

2 - add those context strings in the contructor for MetadataLogger
addContextString(SEQUENCE_GENERATOR_SCHEMA);
addContextString(SEQUENCE_GENERATOR_CATALOG);

3 - add the logging strings to org.eclipse.persistence.internal.localization.i18n.LoggingLocalizationResource
{ "metadata_default_sequence_generator_schema", "The sequence generator schema defined within [{0}] is being defaulted to: {1}." },
{ "metadata_default_sequence_generator_catalog", "The sequence generator catalog defined within [{0}] is being defaulted to: {1}." },

Then have SequenceGeneratorMetadata return those context strings instead and that will do it.

Cheers,
Guy
Comment 3 Andrei Ilitchev CLA 2009-07-17 16:58:50 EDT
Checked into trunk.
Comment 4 Peter Krogh CLA 2009-08-26 09:57:07 EDT
Mass update to change fixed in target.
Comment 5 Peter Krogh CLA 2009-08-26 09:59:54 EDT
Mass update to change fixed in target.
Comment 6 Peter Krogh CLA 2009-08-26 10:05:13 EDT
Mass update to change fixed in target.
Comment 7 Peter Krogh CLA 2009-08-26 10:07:06 EDT
Mass update to change fixed in target.
Comment 8 Andrei Ilitchev CLA 2009-10-14 14:21:27 EDT
*** Bug 259162 has been marked as a duplicate of this bug. ***
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:14:39 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 10 Eclipse Webmaster CLA 2022-06-09 10:23:56 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink