Author: hardy.ferentschik
Date: 2008-06-19 10:59:11 -0400 (Thu, 19 Jun 2008)
New Revision: 14786
Modified:
annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdTest.java
Log:
ANN-750
- Updated tests
- Made sure that binder.setProperty(inferredData.getProperty()); is called in
AnnotationBinder.bindManyToOne. This will ensure that @NaturalId gets properly processed.
Modified: annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-06-19 10:44:33
UTC (rev 14785)
+++ annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-06-19 14:59:11
UTC (rev 14786)
@@ -1993,6 +1993,7 @@
}
binder.setPropertyAccessorName( inferredData.getDefaultAccess() );
binder.setCascade( cascadeStrategy );
+ binder.setProperty(inferredData.getProperty());
Property prop = binder.make();
//composite FK columns are in the same table so its OK
propertyHolder.addProperty( prop, columns );
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java 2008-06-19
10:44:33 UTC (rev 14785)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java 2008-06-19
14:59:11 UTC (rev 14786)
@@ -26,13 +26,13 @@
public void testMappingProperties() {
log.warn("Commented out test");
-//TODO Fix test
-// ClassMetadata metaData = getSessions().getClassMetadata(
-// NaturalIdOnManyToOne.class);
-// assertTrue("Class should have a natural key", metaData
-// .hasNaturalIdentifier());
-// int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
-// assertTrue("Wrong number of elements", propertiesIndex.length == 1);
+
+ ClassMetadata metaData = getSessions().getClassMetadata(
+ NaturalIdOnManyToOne.class);
+ assertTrue("Class should have a natural key", metaData
+ .hasNaturalIdentifier());
+ int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
+ assertTrue("Wrong number of elements", propertiesIndex.length == 1);
}
public void testManyToOneNaturalIdCached() {
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdTest.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdTest.java 2008-06-19
10:44:33 UTC (rev 14785)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/naturalid/NaturalIdTest.java 2008-06-19
14:59:11 UTC (rev 14786)
@@ -26,7 +26,7 @@
assertTrue("Class should have a natural key", metaData
.hasNaturalIdentifier());
int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
- assertTrue("Wrong number of elements", propertiesIndex.length == 1);
+ assertTrue("Wrong number of elements", propertiesIndex.length == 2);
}
public void testNaturalIdCached() {