public void validate() {

		// check each entity descriptor
		for (Entry<Class<?>, EntityDescriptor> entry : entityDescriptors.entrySet()) {
			EntityDescriptor ed = entry.getValue();

			// check pk
			if (ed.getPrimaryKey()==null) {
				throw new MissingPrimaryKeyException(ed);
			}

			// check FKs
			for (Entry<PropertyDescriptorChain, ForeignKey<?>> fkEntry : ed.getForeignKeys().entrySet()) {
				ForeignKey<?> fk = fkEntry.getValue();
				if (!entityDescriptors.containsKey(fk.getForeignEntity())) {
					throw new UnknownFKException(ed.getEntityClass(), fk);
				}
			}
		}

		// good to go
		this.validated = true;
	}