[ 
https://issues.apache.org/jira/browse/OPENJPA-946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700635#action_12700635
 ] 

Ravi P Palacherla commented on OPENJPA-946:
-------------------------------------------

Hi,

I was trying to run TestEJBState  against oracleDB  and I need to get this JIRA 
issue fixed as part of it.

So, I spent some time and I think I can do one of the two things to get this 
fixed:

1) To change the 
"openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/common/apps/ProxiesPC.java"
 to replace the variable name of "date" to something like "date0." ( this is 
more like a workaround rather than an actual fix.)

2)  I found the cause of this issue but I need some one to please review my 
proposed fix before I submit the patch.

The actual fix should go inside "correctName(Table table, Column col)" method 
of class  
"openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingDefaultsImpl.java"
If you check the method , "col.setName(dict.getValidColumnName(name, table));" 
is called only if _defMissing is false. But "_defMissing"  is set to true from 
"PersistenceMappingDefaults.java".

"_defMissing" represents DefaultMissingInfo and as per the doc,  
DefaultMissingInfo  is to determine Whether to default missing column and table 
names rather than throw an exception.

So, if "_defMissing" is true then we have to set the column name properly 
rather than throwing exception ( For example, if column uses reserve word then 
we have to replace the column name.)

But here the opposite is happening meaning, we are changing the column name 
only if the "_defMissing"  is false.

So, the resolution would be to change correctName to:

protected void correctName(Table table, Column col) {
if (_defMissing || _removeHungarianNotation)   // Replaced !_defMissing  with 
_defMissing  )
{
  String name = col.getName();
  if (_removeHungarianNotation)
    name = removeHungarianNotation(name);
    col.setName(dict.getValidColumnName(name, table));
}
}

Also as stated under 
(http://n2.nabble.com/Question-regarding-DefaultMissingInfo-of-MappingDefaults-property.-td2657689.html)

I also tried to use 
case 1: <property name="openjpa.jdbc.MappingDefaults" 
value="default(DefaultMissingInfo=true)"/>  or
case 2: <property name="openjpa.jdbc.MappingDefaults" 
value="default(DefaultMissingInfo=false)"/> or
case 3: <property name="openjpa.jdbc.MappingDefaults" value="jpa"/> ( default) 

but it did not help ( meaning none of the above cases chaged the value of 
"_defMissing" and hence "col.setName(dict.getValidColumnName(name, table));" is 
not called, which is the cause of the issue.

Can someone please review the change before I submit the patch.
The reason for asking someone to review is because I think I did not understand 
the concpet DefaultMissingInfo properly.

Thanks,
Ravi.

> Oracle create table(s) exceptions
> ---------------------------------
>
>                 Key: OPENJPA-946
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-946
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Tim McConnell
>            Assignee: Tim McConnell
>


-- 
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