These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Origin class.
public MappingNotFoundException(String message, Origin origin) { super( message, origin ); } public MappingNotFoundException(Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), origin ); } public MappingNotFoundException(String message, Throwable root, Origin origin) { super( message, root, origin ); } public MappingNotFoundException(Throwable root, Origin origin) { super( String.format( "Mapping (%s) not found : %s", origin.getType(), origin.getName() ), root, origin ); } }
public InvalidMappingException(String customMessage, XmlDocument xmlDocument) { this( customMessage, xmlDocument.getOrigin().getType(), xmlDocument.getOrigin().getName() ); } public InvalidMappingException(String customMessage, Origin origin) { this( customMessage, origin.getType().toString(), origin.getName() ); } public InvalidMappingException(String type, String path) { this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path); } public InvalidMappingException(String type, String path, Throwable cause) { this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path, cause); } public String getType() { return type; }
JAXBContext jc = JAXBContext.newInstance( clazz ); Unmarshaller unmarshaller = jc.createUnmarshaller(); unmarshaller.setSchema( schema ); StreamSource stream = new StreamSource( in ); JAXBElement<T> elem = unmarshaller.unmarshal( stream, clazz ); Origin origin = new Origin( null, fileName ); return new JaxbRoot<T>( elem.getValue(), origin ); } private static Schema getMappingSchema(String schemaVersion, ClassLoaderService classLoaderService) { URL schemaUrl = classLoaderService.locateResource( schemaVersion ); SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI ); Schema schema = null; try { schema = sf.newSchema( schemaUrl ); } catch ( SAXException e ) { LOG.debugf( "Unable to create schema for %s: %s", schemaVersion, e.getMessage() ); } return schema;