Improve support of key generator tables
---------------------------------------

                 Key: OPENJPA-1144
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1144
             Project: OpenJPA
          Issue Type: Improvement
    Affects Versions: 1.2.1
         Environment: OS independent, at least on MS SQL Server and MySQL 5
            Reporter: Michael Simons
            Priority: Minor


The annotation to tell OpenJPA there's a Table Generator:
    @TableGenerator(name = "pkGenSessionConfig", table = "jdo_keygen", 
pkColumnName =
"table_name", valueColumnName = "last_used_id", pkColumnValue = 
"session_config", allocationSize
= 10)
    @Id
    @GeneratedValue(strategy=GenerationType.TABLE, 
generator="pkGenSessionConfig")
    @Column(name="session_config_id", unique=true, nullable=false)
    private int id;

And here's the according SQL generated by OpenJPA:
Unknown column 'TABLE_NAME0' in 'where clause' {prepstmnt 32845046 SELECT 
LAST_USED_ID FROM
jdo_keygen WHERE TABLE_NAME0 = ? FOR UPDATE [params=(String) session_config]} 
[code=1054,
state=42S22]

Fay Wang told us that the name "TABLE_NAME0" is created by OpenJPA because 
DBDictionary.getValidColumnName returns  "table_name0" where we want 
"table_name".

Obvisouly "table_name" is _not_ assumed to be a valid column name, but that is 
not quite correct, because at least for the DBMS MySQL 5 and MS SQL Server it's 
legal. 
Furthermore we would appreciate the possibility to influence what's assumed  a 
valid name for columns, tables and so on.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to