jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • castor
  • CASTOR-2477 Let KeyGenerator taken over role of S...
  • CASTOR-2791

Move buildStatement from SQLStatementCreate to Key Generators

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.3.1
  • Component/s: JDO queries
  • Labels:
    None
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    patch-C2791-20090803.txt
    03/Aug/09 9:25 AM
    40 kB
    AHMAD HASSAN

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
AHMAD HASSAN added a comment - 03/Aug/09 9:25 AM

I have moved buildStatement Methods to the following classes

AbstractAfterKeyGenerator
AbstractBeforeKeyGenerator
SequenceDuringKeyGenerator
NoKeyGenerator

I also added method to the KeyGenerator interface

KeyGenerator

In case of AbstractAfterKeyGenerator and AbstractDuringKeyGenerator, the following code has been added in the catch block

// proceed without this stupid key generator
            FieldDescriptor fldDesc = _engine.getDescriptor().getIdentity();
            int[] sqlTypes = new FieldDescriptorJDONature(fldDesc).getSQLType();
            int sqlType = (sqlTypes == null) ? 0 : sqlTypes[0]; 
            try {
                NoKeyGeneratorFactory noKeyGenFac = new NoKeyGeneratorFactory();
                
                KeyGenerator keyGen = noKeyGenFac.getKeyGenerator(_factory, null, sqlType); 
                keyGen.buildStatement(_engine);
                return keyGen;
            } catch (MappingException ex) {
                LOG.fatal(ex);
            }

The above code uses NoKeyGenerator. Previously the above implementation was done using the folliwng

_keyGen = null;
buildStatementWithIdentitites();

Regards, Ahmad

Show
AHMAD HASSAN added a comment - 03/Aug/09 9:25 AM I have moved buildStatement Methods to the following classes
AbstractAfterKeyGenerator
AbstractBeforeKeyGenerator
SequenceDuringKeyGenerator
NoKeyGenerator
I also added method to the KeyGenerator interface
KeyGenerator
In case of AbstractAfterKeyGenerator and AbstractDuringKeyGenerator, the following code has been added in the catch block
// proceed without this stupid key generator
            FieldDescriptor fldDesc = _engine.getDescriptor().getIdentity();
            int[] sqlTypes = new FieldDescriptorJDONature(fldDesc).getSQLType();
            int sqlType = (sqlTypes == null) ? 0 : sqlTypes[0]; 
            try {
                NoKeyGeneratorFactory noKeyGenFac = new NoKeyGeneratorFactory();
                
                KeyGenerator keyGen = noKeyGenFac.getKeyGenerator(_factory, null, sqlType); 
                keyGen.buildStatement(_engine);
                return keyGen;
            } catch (MappingException ex) {
                LOG.fatal(ex);
            }
The above code uses NoKeyGenerator. Previously the above implementation was done using the folliwng
_keyGen = null;
buildStatementWithIdentitites();
Regards, Ahmad
Hide
Permalink
Ralf Joachim added a comment - 03/Aug/09 5:51 PM

Commited patch as is.

Show
Ralf Joachim added a comment - 03/Aug/09 5:51 PM Commited patch as is.

People

  • Assignee:
    AHMAD HASSAN
    Reporter:
    AHMAD HASSAN
Vote (0)
Watch (0)

Dates

  • Created:
    02/Aug/09 10:10 AM
    Updated:
    30/Dec/09 4:21 AM
    Resolved:
    03/Aug/09 5:51 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.