Package org.hibernate.metamodel.source

Examples of org.hibernate.metamodel.source.MappingException


  @SuppressWarnings( { "unchecked" })
  public JaxbRoot unmarshal(Document document, Origin origin) {
    Element rootElement = document.getDocumentElement();
    if ( rootElement == null ) {
      throw new MappingException( "No root element found", origin );
    }

    final Schema validationSchema;
    final Class jaxbTarget;

    if ( "entity-mappings".equals( rootElement.getNodeName() ) ) {
      final String explicitVersion = rootElement.getAttribute( "version" );
      validationSchema = resolveSupportedOrmXsd( explicitVersion );
      jaxbTarget = JaxbEntityMappings.class;
    }
    else {
      validationSchema = hbmSchema();
      jaxbTarget = JaxbHibernateMapping.class;
    }

    final Object target;
    try {
      JAXBContext jaxbContext = JAXBContext.newInstance( jaxbTarget );
      Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
      unmarshaller.setSchema( validationSchema );
      target = unmarshaller.unmarshal( new DOMSource( document ) );
    }
    catch ( JAXBException e ) {
      throw new MappingException( "Unable to perform unmarshalling", e, origin );
    }

    return new JaxbRoot( target, origin );
  }
View Full Code Here


        }
        catch (ClassLoadingException e) {
          throw e;
        }
        catch (Exception e) {
          throw new MappingException(
              "could not instantiate custom database object class [" + className + "]",
              jaxbRoot.getOrigin()
          );
        }
      }
View Full Code Here

              paramElement.getName(),
              metadata.getTypeResolver().heuristicType( paramElement.getType() )
          );
        }
        else {
          throw new MappingException( "Unrecognized nested filter content", jaxbRoot.getOrigin() );
        }
      }
      if ( condition == null ) {
        condition = filterDefinition.getCondition();
      }
View Full Code Here

      String profileName = fetchProfile.getName();
      Set<FetchProfile.Fetch> fetches = new HashSet<FetchProfile.Fetch>();
      for ( XMLFetchProfileElement.XMLFetch fetch : fetchProfile.getFetch() ) {
        String entityName = fetch.getEntity() == null ? containingEntityName : fetch.getEntity();
        if ( entityName == null ) {
          throw new MappingException(
              "could not determine entity for fetch-profile fetch [" + profileName + "]:[" +
                  fetch.getAssociation() + "]",
              jaxbRoot.getOrigin()
          );
        }
View Full Code Here

      }
      else if ( XMLSqlQueryElement.class.isInstance( queryOrSqlQuery ) ) {
//        bindNamedSQLQuery( element, null, mappings );
      }
      else {
        throw new MappingException(
            "unknown type of query: " +
                queryOrSqlQuery.getClass().getName(), jaxbRoot.getOrigin()
        );
      }
    }
View Full Code Here

    else if ( pluralAttributeElement.getManyToAny() != null ) {
      throw new NotYetImplementedException( "Support for many-to-any not yet implemented" );
//      return PluralAttributeElementNature.MANY_TO_ANY;
    }
    else {
      throw new MappingException(
          "Unexpected collection element type : " + pluralAttributeElement.getName(),
          bindingContext().getOrigin()
      );
    }
  }
View Full Code Here

    }
    else if ( "false".equals( lazySelection ) ) {
      return FetchTiming.IMMEDIATE;
    }

    throw new MappingException(
        String.format(
            "Unexpected lazy selection [%s] on '%s'",
            lazySelection,
            pluralAttributeElement.getName()
        ),
View Full Code Here

        }
        catch (ClassLoadingException e) {
          throw e;
        }
        catch (Exception e) {
          throw new MappingException(
              "could not instantiate custom database object class [" + className + "]",
              origin()
          );
        }
      }
View Full Code Here

              paramElement.getName(),
              metadata.getTypeResolver().heuristicType( paramElement.getType() )
          );
        }
        else {
          throw new MappingException( "Unrecognized nested filter content", origin() );
        }
      }
      if ( condition == null ) {
        condition = filterDefinition.getCondition();
      }
View Full Code Here

      String profileName = fetchProfile.getName();
      Set<FetchProfile.Fetch> fetches = new HashSet<FetchProfile.Fetch>();
      for ( JaxbFetchProfileElement.JaxbFetch fetch : fetchProfile.getFetch() ) {
        String entityName = fetch.getEntity() == null ? containingEntityName : fetch.getEntity();
        if ( entityName == null ) {
          throw new MappingException(
              "could not determine entity for fetch-profile fetch [" + profileName + "]:[" +
                  fetch.getAssociation() + "]",
              origin()
          );
        }
View Full Code Here

TOP

Related Classes of org.hibernate.metamodel.source.MappingException

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.