moved unique index-name check before the check of the id field to also fail on those on managed/advanced-mapping entities

This commit is contained in:
Michael Hunger
2013-02-11 15:30:59 +01:00
parent e8c2992f60
commit bbb22d2dea
2 changed files with 7 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation fot the field that virtually provides the Id of the graph entity (node or relationship), type of the field should be long
* Annotation fot the field that virtually provides the Id of the graph entity (node or relationship), type of the field should be Long
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD,ElementType.METHOD})

View File

@@ -68,12 +68,6 @@ public class Neo4jPersistentEntityImpl<T> extends BasicPersistentEntity<T, Neo4j
@Override
public void verify() {
super.verify();
if (isManaged() || getType().isInterface()) {
return;
}
final Neo4jPersistentProperty idProperty = getIdProperty();
if (idProperty == null) throw new MappingException("No id property in " + this);
if (idProperty.getType().isPrimitive()) throw new MappingException("The type of the id-property in " + idProperty+" must not be a primitive type but an object type like java.lang.Long");
doWithProperties(new PropertyHandler<Neo4jPersistentProperty>() {
Neo4jPersistentProperty unique = null;
public void doWithPersistentProperty(Neo4jPersistentProperty persistentProperty) {
@@ -83,6 +77,12 @@ public class Neo4jPersistentEntityImpl<T> extends BasicPersistentEntity<T, Neo4j
}
}
});
if (isManaged() || getType().isInterface()) {
return;
}
final Neo4jPersistentProperty idProperty = getIdProperty();
if (idProperty == null) throw new MappingException("No id property in " + this);
if (idProperty.getType().isPrimitive()) throw new MappingException("The type of the id-property in " + idProperty+" must not be a primitive type but an object type like java.lang.Long");
}
public boolean useShortNames() {