Ok - Here is my proposed patch along the lines of option #1 -
Index:
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java
===================================================================
---
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java
(revision 1569020)
+++
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DefaultIdentifierConfiguration.java
(working copy)
@@ -52,7 +52,7 @@
}
public String getLeadingDelimiter() {
- return IdentifierUtil.DOUBLE_QUOTE;
+ return IdentifierUtil.ESCAPED_DOUBLE_QUOTE;
}
public String getIdentifierDelimiter() {
@@ -73,7 +73,7 @@
}
public String getTrailingDelimiter() {
- return IdentifierUtil.DOUBLE_QUOTE;
+ return IdentifierUtil.ESCAPED_DOUBLE_QUOTE;
}
public boolean getSupportsDelimitedIdentifiers() {
Index:
openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtil.java
===================================================================
---
openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtil.java
(revision 1569020)
+++
openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierUtil.java
(working copy)
@@ -24,6 +24,7 @@
*/
public interface IdentifierUtil {
public static final String DOUBLE_QUOTE = "\"";
+ public static final String ESCAPED_DOUBLE_QUOTE = "\\\"";
public static final String DOT = ".";
public static final String UNDERSCORE = "_";
public static final String SPACE = " ";
On Mon, Feb 17, 2014 at 5:48 PM, Rick Curtis <[email protected]> wrote:
> I would start with option #1
>
> Thanks,
> Rick
>
>
> On Mon, Feb 17, 2014 at 11:31 AM, Aron Lurie <[email protected]
> >wrote:
>
> > Hi All,
> >
> > Running on trunk, I'm currently facing a problem very similar to
> > OPENJPA-1540. When I run the ReverseMappingTool on an Oracle database
> with
> > a lowercase column name, I end up with syntactically incorrect source
> code.
> > Whereas I should get output like this:
> >
> > @Column(name="\"foobar\"")
> >
> > I instead get un-compileable output like this:
> >
> > @Column(name=""foobar"")
> >
> > The reason why the problem only affects lowercase column names is because
> > Oracle generally requires names in all upper case. If a name is specified
> > with quotes around it, then it can be allowed to contain lowercase
> > characters.
> >
> > I generally see two ways I can fix this:
> >
> > 1) Change the way the DBIdentifier's are initialized to surround the
> > identifier with a delimiter that includes the escape \.
> >
> > 2) Change the serialization stack (i.e.
> > AnnotationPersistenceMetaDataSerializer.serialize and
> > AnnotationEntry.toString) to run some character escape utility (like
> > StringEscapeUtils.escapeJava) at String construction time.
> >
> > Which approach here is best? Or is there a better way I haven't
> considered?
> >
> > Thanks,
> > Aron
> >
>
>
>
> --
> *Rick Curtis*
>