Author: epbernard
Date: 2008-03-04 17:42:53 -0500 (Tue, 04 Mar 2008)
New Revision: 14390
Modified:
annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
annotations/trunk/src/java/org/hibernate/cfg/ClassPropertyHolder.java
annotations/trunk/src/java/org/hibernate/cfg/CollectionPropertyHolder.java
annotations/trunk/src/java/org/hibernate/cfg/ComponentPropertyHolder.java
annotations/trunk/src/java/org/hibernate/cfg/PropertyHolder.java
Log:
ANN-650 better exception when @Version is set in an @Embeddable class
Modified: annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-03-04 21:22:12
UTC (rev 14389)
+++ annotations/trunk/src/java/org/hibernate/cfg/AnnotationBinder.java 2008-03-04 22:42:53
UTC (rev 14390)
@@ -1312,6 +1312,12 @@
+ propertyHolder.getEntityName()
);
}
+ if ( ! propertyHolder.isEntity() ) {
+ throw new AnnotationException(
+ "Unable to define @Version on an embedded class: "
+ + propertyHolder.getEntityName()
+ );
+ }
log.debug( inferredData.getPropertyName() + " is a version property" );
RootClass rootClass = (RootClass) propertyHolder.getPersistentClass();
PropertyBinder propBinder = new PropertyBinder();
Modified: annotations/trunk/src/java/org/hibernate/cfg/ClassPropertyHolder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/ClassPropertyHolder.java 2008-03-04
21:22:12 UTC (rev 14389)
+++ annotations/trunk/src/java/org/hibernate/cfg/ClassPropertyHolder.java 2008-03-04
22:42:53 UTC (rev 14390)
@@ -106,6 +106,10 @@
return false;
}
+ public boolean isEntity() {
+ return true;
+ }
+
public PersistentClass getPersistentClass() {
return persistentClass;
}
Modified: annotations/trunk/src/java/org/hibernate/cfg/CollectionPropertyHolder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/CollectionPropertyHolder.java 2008-03-04
21:22:12 UTC (rev 14389)
+++ annotations/trunk/src/java/org/hibernate/cfg/CollectionPropertyHolder.java 2008-03-04
22:42:53 UTC (rev 14390)
@@ -56,6 +56,10 @@
return false;
}
+ public boolean isEntity() {
+ return false;
+ }
+
public String getEntityName() {
return collection.getOwner().getEntityName();
}
Modified: annotations/trunk/src/java/org/hibernate/cfg/ComponentPropertyHolder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/ComponentPropertyHolder.java 2008-03-04
21:22:12 UTC (rev 14389)
+++ annotations/trunk/src/java/org/hibernate/cfg/ComponentPropertyHolder.java 2008-03-04
22:42:53 UTC (rev 14390)
@@ -91,6 +91,10 @@
return true;
}
+ public boolean isEntity() {
+ return false;
+ }
+
public void setParentProperty(String parentProperty) {
component.setParentProperty( parentProperty );
}
Modified: annotations/trunk/src/java/org/hibernate/cfg/PropertyHolder.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/PropertyHolder.java 2008-03-04 21:22:12
UTC (rev 14389)
+++ annotations/trunk/src/java/org/hibernate/cfg/PropertyHolder.java 2008-03-04 22:42:53
UTC (rev 14390)
@@ -30,6 +30,8 @@
boolean isComponent();
+ boolean isEntity();
+
void setParentProperty(String parentProperty);
String getPath();
Show replies by date