[hibernate-commits] Hibernate SVN: r14735 - in annotations/trunk: src/java/org/hibernate/cfg and 3 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Jun 4 10:05:50 EDT 2008
Author: hardy.ferentschik
Date: 2008-06-04 10:05:50 -0400 (Wed, 04 Jun 2008)
New Revision: 14735
Added:
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java
annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Category.java
Modified:
annotations/trunk/
annotations/trunk/src/java/org/hibernate/cfg/Ejb3JoinColumn.java
annotations/trunk/src/test/org/hibernate/test/annotations/quote/QuoteTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/quote/Role.java
annotations/trunk/src/test/org/hibernate/test/annotations/quote/User.java
Log:
ANN-718 :
- Added test case for issue
- Changed Ejb3JoinColumn to use Column.getQuotedName() when calling Mappings.getMappings().getLogicalColumnNamegetMappings()
- Added/Edited some svn properties
Property changes on: annotations/trunk
___________________________________________________________________
Name: svn:ignore
+ target
test_output
build
.*
Modified: annotations/trunk/src/java/org/hibernate/cfg/Ejb3JoinColumn.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/Ejb3JoinColumn.java 2008-06-04 04:51:36 UTC (rev 14734)
+++ annotations/trunk/src/java/org/hibernate/cfg/Ejb3JoinColumn.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -208,7 +208,7 @@
) {
Column col = (Column) identifier.getColumnIterator().next();
- String defaultName = mappings.getLogicalColumnName( col.getName(), identifier.getTable() );
+ String defaultName = mappings.getLogicalColumnName( col.getQuotedName(), identifier.getTable() );
if ( pkJoinAnn != null || joinAnn != null ) {
String colName;
String columnDefinition;
@@ -268,7 +268,7 @@
) {
String columnName;
String logicalReferencedColumn = getMappings().getLogicalColumnName(
- referencedColumn.getName(), referencedEntity.getTable()
+ referencedColumn.getQuotedName(), referencedEntity.getTable()
);
boolean mappedBySide = mappedByTableName != null || mappedByPropertyName != null;
boolean ownerSide = getPropertyName() != null;
Added: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -0,0 +1,27 @@
+//$Id$
+package org.hibernate.test.annotations.backquotes;
+
+import junit.framework.TestCase;
+
+import org.hibernate.cfg.AnnotationConfiguration;
+
+/**
+ * Testcase for ANN-718 - @JoinTable / @JoinColumn fail when using backquotes in PK field name.
+ *
+ * @author Hardy Ferentschik
+ *
+ */
+public class BackquoteTest extends TestCase {
+
+ public void testBackquotes() {
+ try {
+ AnnotationConfiguration config = new AnnotationConfiguration();
+ config.addAnnotatedClass(Bug.class);
+ config.addAnnotatedClass(Category.class);
+ config.buildSessionFactory();
+ }
+ catch( Exception e ) {
+ fail(e.getMessage());
+ }
+ }
+}
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/BackquoteTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -0,0 +1,49 @@
+//$Id$
+package org.hibernate.test.annotations.backquotes;
+
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+
+ at Entity
+public class Bug
+{
+ @Id
+ @Column(name="`bug_id`")
+ private int id;
+
+ @Column(name="`title`")
+ private String title;
+
+ @ManyToMany
+ @JoinTable(name="`bug_category`")
+ private List<Category> categories;
+
+ public List<Category> getCategories() {
+ return categories;
+ }
+
+ public void setCategories(List<Category> categories) {
+ this.categories = categories;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Bug.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Category.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Category.java (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Category.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -0,0 +1,33 @@
+//$Id$
+package org.hibernate.test.annotations.backquotes;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+ at Entity
+public class Category
+{
+ @Id
+ @Column(name="`cat_id`")
+ private int id;
+
+ @Column(name="`title`")
+ private String title;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/backquotes/Category.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/quote/QuoteTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/quote/QuoteTest.java 2008-06-04 04:51:36 UTC (rev 14734)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/quote/QuoteTest.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -1,4 +1,4 @@
-//$Id: $
+//$Id$
package org.hibernate.test.annotations.quote;
import org.hibernate.test.annotations.TestCase;
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/quote/QuoteTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/quote/Role.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/quote/Role.java 2008-06-04 04:51:36 UTC (rev 14734)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/quote/Role.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -1,4 +1,4 @@
-//$Id: $
+//$Id$
package org.hibernate.test.annotations.quote;
import java.io.Serializable;
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/quote/Role.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/quote/User.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/quote/User.java 2008-06-04 04:51:36 UTC (rev 14734)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/quote/User.java 2008-06-04 14:05:50 UTC (rev 14735)
@@ -1,4 +1,4 @@
-//$Id: $
+//$Id$
package org.hibernate.test.annotations.quote;
import java.io.Serializable;
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/quote/User.java
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the hibernate-commits
mailing list