use of org.hibernate.boot.spi.XmlMappingBinderAccess in project hibernate-orm by hibernate.
the class CacheableHbmXmlTest method before.
@Before
public void before() throws Exception {
ssr = new StandardServiceRegistryBuilder().build();
binder = new XmlMappingBinderAccess(ssr).getMappingBinder();
final URL hbmXmlUrl = getClass().getClassLoader().getResource(HBM_RESOURCE_NAME);
if (hbmXmlUrl == null) {
throw couldNotFindHbmXmlFile();
}
hbmXmlFile = new File(hbmXmlUrl.getFile());
if (!hbmXmlFile.exists()) {
throw couldNotFindHbmXmlFile();
}
hbmXmlBinFile = CacheableFileXmlSource.determineCachedFile(hbmXmlFile);
}
use of org.hibernate.boot.spi.XmlMappingBinderAccess in project hibernate-orm by hibernate.
the class XmlBindingChecker method checkValidGeneration.
public static void checkValidGeneration(JaxbHbmHibernateMapping hbmMapping) throws Exception {
JAXBContext jaxbContext = JAXBContext.newInstance(JaxbHbmHibernateMapping.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
jaxbMarshaller.marshal(hbmMapping, bos);
ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
ServiceRegistry sr = new StandardServiceRegistryBuilder().build();
new XmlMappingBinderAccess(sr).bind(is);
}
Aggregations