The classDescriptorMap variable in HibernateEntityManagerFactoryImpl.buildDeploymentResources is defined as a HashMap. In effect the order of classes returned by DeploymentResources.getClassDescriptor is unpredictable and might be different from the order of class names in persistence.xml. Please replace the HashMap with a LinkedHashMap to make the order predictable. The existing implementation causes problems with some ManyToOne mappings that must be processed in a proper order to be mapped successfully.
|