Author: hardy.ferentschik
Date: 2008-06-06 04:16:25 -0400 (Fri, 06 Jun 2008)
New Revision: 14747
Modified:
annotations/trunk/src/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java
Log:
ANN-718 : Applied the fix from Ejb3JoinColumn to IndexOrUniqueKeySecondPass as well
Modified: annotations/trunk/src/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java
===================================================================
---
annotations/trunk/src/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java 2008-06-06
08:09:59 UTC (rev 14746)
+++
annotations/trunk/src/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java 2008-06-06
08:16:25 UTC (rev 14747)
@@ -58,7 +58,7 @@
}
if ( column != null ) {
this.table = column.getTable();
- addConstraintToColumn( mappings.getLogicalColumnName( column.getName(), table ) );
+ addConstraintToColumn( mappings.getLogicalColumnName(
column.getMappingColumn().getQuotedName(), table ) );
}
}
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java 2008-06-06
08:09:59 UTC (rev 14746)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java 2008-06-06
08:16:25 UTC (rev 14747)
@@ -1,9 +1,14 @@
//$Id$
package org.hibernate.test.annotations.backquotes;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
import junit.framework.TestCase;
import org.hibernate.cfg.AnnotationConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Testcase for ANN-718 - @JoinTable / @JoinColumn fail when using backquotes in PK field
name.
@@ -13,6 +18,8 @@
*/
public class BackquoteTest extends TestCase {
+ private Logger log = LoggerFactory.getLogger(BackquoteTest.class);
+
public void testBackquotes() {
try {
AnnotationConfiguration config = new AnnotationConfiguration();
@@ -21,6 +28,9 @@
config.buildSessionFactory();
}
catch( Exception e ) {
+ StringWriter writer = new StringWriter();
+ e.printStackTrace(new PrintWriter(writer));
+ log.debug(writer.toString());
fail(e.getMessage());
}
}
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java 2008-06-06
08:09:59 UTC (rev 14746)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java 2008-06-06
08:16:25 UTC (rev 14747)
@@ -9,6 +9,8 @@
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
+import org.hibernate.annotations.Index;
+
@Entity
public class Bug
{
@@ -17,6 +19,7 @@
private int id;
@Column(name="`title`")
+ @Index(name="`titleindex`")
private String title;
@ManyToMany
Show replies by date