[ 
https://issues.apache.org/jira/browse/OPENJPA-1144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla resolved OPENJPA-1144.
--------------------------------------
    Resolution: Fixed

Already fixed on master: DBIdentifierUtilImpl.makeIdentifierValid appends '0' 
only when the COLUMN rule's reserved words match. That rule is 
ColumnIdentifierRule(invalidColumnWordSet) (DBDictionary.java:744, filled at 
:5722 from sql-invalid-column-names.rsrc and per-dictionary lists such as 
MySQLDictionary.java:148), and none of these contain TABLE_NAME, which appears 
only in sql-keywords.rsrc. Closing.

> 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
>         Attachments: persistence.xml
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> 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 was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to