Package org.hibernate

Examples of org.hibernate.MappingException


   * @param sequenceName the name of the sequence
   * @return The "nextval" fragment.
   * @throws MappingException If sequences are not supported.
   */
  public String getSelectSequenceNextValString(String sequenceName) throws MappingException {
    throw new MappingException( getClass().getName() + " does not support sequences" );
  }
View Full Code Here


   * @param sequenceName The name of the sequence
   * @return The sequence creation command
   * @throws MappingException If sequences are not supported.
   */
  protected String getCreateSequenceString(String sequenceName) throws MappingException {
    throw new MappingException( getClass().getName() + " does not support sequences" );
  }
View Full Code Here

   */
  protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) throws MappingException {
    if ( supportsPooledSequences() ) {
      return getCreateSequenceString( sequenceName ) + " start with " + initialValue + " increment by " + incrementSize;
    }
    throw new MappingException( getClass().getName() + " does not support pooled sequences" );
  }
View Full Code Here

   * @param sequenceName The name of the sequence
   * @return The sequence drop commands
   * @throws MappingException If sequences are not supported.
   */
  protected String getDropSequenceString(String sequenceName) throws MappingException {
    throw new MappingException( getClass().getName() + " does not support sequences" );
  }
View Full Code Here

  @Override
  public org.hibernate.type.Type getIdentifierType(String entityName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    return entityBinding
        .getHierarchyDetails()
        .getEntityIdentifier()
        .getValueBinding()
View Full Code Here

  @Override
  public String getIdentifierPropertyName(String entityName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    AttributeBinding idBinding = entityBinding.getHierarchyDetails().getEntityIdentifier().getValueBinding();
    return idBinding == null ? null : idBinding.getAttribute().getName();
  }
View Full Code Here

  @Override
  public org.hibernate.type.Type getReferencedPropertyType(String entityName, String propertyName) throws MappingException {
    EntityBinding entityBinding = getEntityBinding( entityName );
    if ( entityBinding == null ) {
      throw new MappingException( "Entity binding not known: " + entityName );
    }
    // TODO: should this call EntityBinding.getReferencedAttributeBindingString), which does not exist yet?
    AttributeBinding attributeBinding = entityBinding.locateAttributeBinding( propertyName );
    if ( attributeBinding == null ) {
      throw new MappingException( "unknown property: " + entityName + '.' + propertyName );
    }
    return attributeBinding.getHibernateTypeDescriptor().getResolvedTypeMapping();
  }
View Full Code Here

    super( queryDef.getQueryString(), queryDef.getFlushMode(), session, parameterMetadata );
    this.session = session;
    if ( queryDef.getResultSetRef() != null ) {
      ResultSetMappingDefinition definition = session.getFactory().getResultSetMapping( queryDef.getResultSetRef() );
      if ( definition == null ) {
        throw new MappingException( "Unable to find resultset-ref definition: " + queryDef.getResultSetRef() );
      }
      this.queryReturns = new ArrayList<NativeSQLQueryReturn>( Arrays.asList( definition.getQueryReturns() ) );
    }
    else if ( queryDef.getQueryReturns() != null && queryDef.getQueryReturns().length > 0 ) {
      this.queryReturns = new ArrayList<NativeSQLQueryReturn>( Arrays.asList( queryDef.getQueryReturns() ) );
View Full Code Here

  @Override
  public SQLQuery setResultSetMapping(String name) {
    ResultSetMappingDefinition mapping = session.getFactory().getResultSetMapping( name );
    if ( mapping == null ) {
      throw new MappingException( "Unknown SqlResultSetMapping [" + name + "]" );
    }
    NativeSQLQueryReturn[] returns = mapping.getQueryReturns();
    queryReturns.addAll( Arrays.asList( returns ) );
    return this;
  }
View Full Code Here

  }

  private NamedSQLQueryDefinition findNamedNativeQuery(String queryName) {
    NamedSQLQueryDefinition nsqlqd = factory.getNamedSQLQuery( queryName );
    if ( nsqlqd == null ) {
      throw new MappingException( "Named native query not found: " + queryName );
    }
    return nsqlqd;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.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.