Using hibernate 4 I used cfg.configure("/"+StandardServiceRegistryBuilder.DEFAULT_CFG_RESOURCE_NAME); where all resource files have been referenced within the hibernate xml file. This code has been much faster.
First, in 5.0 you can reference the mapping files in cfg.xml file too. In either case, in 4.x or 5.x the result is the same, The calls route through the same code. Neither is going to be any faster than the other.
My guess is that you are using a deprecated DTD. There was a bug fixed in CR3 where deprecated DTDs (the VERY old SF ones) were not resolved locally; they would each result in network lookups. Again, that was fixed in CR3 so I'd try that first. Otherwise I need an example mapping file.
And if it happens to be the case that you are still using these old, deprecated DTDs I'd suggest updating. Support for them will be removed in a later release.
I am going to close this as I feel pretty certain this is what you are seeing. Reopen or comment if that is actually not the case.
|