[hibernate-commits] Hibernate SVN: r14418 - in annotations/trunk/src: test/org/hibernate/test/annotations/idmanytoone/alphabetical and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Mar 10 20:25:55 EDT 2008


Author: epbernard
Date: 2008-03-10 20:25:55 -0400 (Mon, 10 Mar 2008)
New Revision: 14418

Added:
   annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Acces.java
   annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/AlphabeticalManyToOneTest.java
   annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Benefserv.java
   annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Droitacces.java
   annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Service.java
Modified:
   annotations/trunk/src/java/org/hibernate/cfg/ToOneFkSecondPass.java
Log:
ANN-694 incorrect circularity error when the manytoone starts with the id proeprty chars.

Modified: annotations/trunk/src/java/org/hibernate/cfg/ToOneFkSecondPass.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/ToOneFkSecondPass.java	2008-03-10 23:51:06 UTC (rev 14417)
+++ annotations/trunk/src/java/org/hibernate/cfg/ToOneFkSecondPass.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -29,7 +29,7 @@
 	private String path;
 	private String entityClassName;
 
-	ToOneFkSecondPass(
+	public ToOneFkSecondPass(
 			ToOne value, Ejb3JoinColumn[] columns, boolean unique, String entityClassName, String path, ExtendedMappings mappings
 	) {
 		super( value, columns );
@@ -52,7 +52,7 @@
 		}
 		else if ( property != null) {
 			//try explicit identifier property
-			return path.startsWith( property.getName() );
+			return path.startsWith( property.getName() + "." );
 		}
 		else {
 			//try the embedded property

Added: annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Acces.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Acces.java	                        (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Acces.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -0,0 +1,17 @@
+//$
+package org.hibernate.test.annotations.idmanytoone.alphabetical;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+ at Entity
+public class Acces implements Serializable {
+	@Id
+	private BigInteger idpk;
+
+	@ManyToOne
+	private Droitacces idpkdracc;
+}
\ No newline at end of file

Added: annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/AlphabeticalManyToOneTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/AlphabeticalManyToOneTest.java	                        (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/AlphabeticalManyToOneTest.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -0,0 +1,22 @@
+//$
+package org.hibernate.test.annotations.idmanytoone.alphabetical;
+
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class AlphabeticalManyToOneTest extends TestCase {
+	public void testAlphabeticalTest() throws Exception {
+		//test through deployment
+	}
+
+	protected Class[] getMappings() {
+		return new Class[] {
+				Acces.class,
+				Droitacces.class,
+				Benefserv.class,
+				Service.class
+		};
+	}
+}

Added: annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Benefserv.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Benefserv.java	                        (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Benefserv.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -0,0 +1,17 @@
+//$
+package org.hibernate.test.annotations.idmanytoone.alphabetical;
+
+import java.math.BigInteger;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+ at Entity
+public class Benefserv {
+	@Id
+	private BigInteger idpk;
+
+	@ManyToOne
+	private Service idpkser;
+}

Added: annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Droitacces.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Droitacces.java	                        (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Droitacces.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -0,0 +1,17 @@
+//$
+package org.hibernate.test.annotations.idmanytoone.alphabetical;
+
+import java.math.BigInteger;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+ at Entity
+public class Droitacces {
+	@Id
+	private BigInteger idpk;
+
+	@ManyToOne
+	private Benefserv idpkbenef;
+}

Added: annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Service.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Service.java	                        (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/idmanytoone/alphabetical/Service.java	2008-03-11 00:25:55 UTC (rev 14418)
@@ -0,0 +1,14 @@
+//$
+package org.hibernate.test.annotations.idmanytoone.alphabetical;
+
+import java.math.BigInteger;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+
+ at Entity
+public class Service {
+    @Id
+    private BigInteger idpk;
+}




More information about the hibernate-commits mailing list