Package org.hibernate.util.xml

Examples of org.hibernate.util.xml.XmlDocument


        continue;
      }
      final BufferedInputStream is = new BufferedInputStream( resourceAsStream );
      try {
        final InputSource inputSource = new InputSource( is );
        XmlDocument xmlDocument = MappingReader.INSTANCE.readMappingDocument(
            cfg.getEntityResolver(),
            inputSource,
            new OriginImpl( "persistence-unit-info", xmlFile )
        );
        Element rootElement = xmlDocument.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here


        log.info( "Unable to resolve mapping file [{}]", xmlFile );
        continue;
      }
      final InputSource inputSource = new InputSource( fileInputStream );

      XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument(
          cfg.getEntityResolver(),
          inputSource,
          new OriginImpl( "persistence-unit-info", xmlFile )
      );
      xmlDocuments.add( metadataXml );
      try {
        final Element rootElement = metadataXml.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here

  private XmlDocument add(InputSource inputSource, String originType, String originName) {
    return add( inputSource, new OriginImpl( originType, originName ) );
  }

  private XmlDocument add(InputSource inputSource, Origin origin) {
    XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument( entityResolver, inputSource, origin );
    add( metadataXml );
    return metadataXml;
  }
View Full Code Here

    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( "file", xmlFile.toString() );
    }

    log.info( "Reading mappings from file: " + xmlFile );
    XmlDocument metadataXml = add( inputSource, "file", name );

    try {
      log.debug( "Writing cache file for: " + xmlFile + " to: " + cachedFile );
      SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), new FileOutputStream( cachedFile ) );
    }
    catch ( SerializationException e ) {
      log.warn( "Could not write cached file: " + cachedFile, e );
    }
    catch ( FileNotFoundException e ) {
View Full Code Here

TOP

Related Classes of org.hibernate.util.xml.XmlDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.