Java 类org.hibernate.cfg.NotYetImplementedException 实例源码

项目:hibernate-ogm-redis    文件:RedisHashEnumType.java   
@Override
public void nullSafeSet(Tuple resultset, Object value, String[] names, SessionImplementor session)
        throws HibernateException {
    if ( names.length > 1 ) {
        throw new NotYetImplementedException( "Multi column property not implemented yet" );
    }
    if ( value == null ) {
        log.tracef( "binding [null] to parameter [$s]", names[0] );
    }
    else {
        Object endValue = isOrdinal() ?
                Integer.toString( ( (Enum<?>) value ).ordinal() ) :
                ( (Enum<?>) value ).name();
        log.tracef( "binding [$s] to parameter(s) $s", endValue, names[0] );
        resultset.put( names[0], endValue );
    }
}
项目:lams    文件:Binder.java   
private void bindCollectionElement(
        PluralAttributeSource attributeSource,
        AbstractPluralAttributeBinding pluralAttributeBinding) {
    final PluralAttributeElementSource elementSource = attributeSource.getElementSource();
    if ( elementSource.getNature() == PluralAttributeElementNature.BASIC ) {
        final BasicPluralAttributeElementSource basicElementSource = (BasicPluralAttributeElementSource) elementSource;
        final BasicCollectionElement basicCollectionElement = (BasicCollectionElement) pluralAttributeBinding.getCollectionElement();
        resolveTypeInformation(
                basicElementSource.getExplicitHibernateTypeSource(),
                pluralAttributeBinding.getAttribute(),
                basicCollectionElement
        );
        // todo : temp
        return;
    }
    // todo : implement
    throw new NotYetImplementedException(
            String.format(
                    "Support for collection elements of type %s not yet implemented",
                    elementSource.getNature()
            )
    );
}
项目:lams    文件:RootEntitySourceImpl.java   
@Override
public IdentifierSource getIdentifierSource() {
    IdType idType = getEntityClass().getIdType();
    switch ( idType ) {
        case SIMPLE: {
            BasicAttribute attribute = getEntityClass().getIdAttributes().iterator().next();
            return new SimpleIdentifierSourceImpl( attribute, getEntityClass().getAttributeOverrideMap() );
        }
        case COMPOSED: {
            throw new NotYetImplementedException( "Composed ids must still be implemented." );
        }
        case EMBEDDED: {
            throw new NotYetImplementedException( "Embedded ids must still be implemented." );
        }
        default: {
            throw new AssertionFailure( "The root entity needs to specify an identifier" );
        }
    }
}
项目:lams    文件:Binder.java   
private void bindCollectionIndex(
        PluralAttributeSource attributeSource,
        AbstractPluralAttributeBinding pluralAttributeBinding) {
    if ( attributeSource.getPluralAttributeNature() != PluralAttributeNature.LIST
            && attributeSource.getPluralAttributeNature() != PluralAttributeNature.MAP ) {
        return;
    }

    // todo : implement
    throw new NotYetImplementedException();
}
项目:lams    文件:AbstractPluralAttributeSourceImpl.java   
private PluralAttributeElementSource interpretElementType() {
        if ( pluralAttributeElement.getElement() != null ) {
            return new BasicPluralAttributeElementSourceImpl(
                    pluralAttributeElement.getElement(), container.getLocalBindingContext()
            );
        }
        else if ( pluralAttributeElement.getCompositeElement() != null ) {
            return new CompositePluralAttributeElementSourceImpl(
                    pluralAttributeElement.getCompositeElement(), container.getLocalBindingContext()
            );
        }
        else if ( pluralAttributeElement.getOneToMany() != null ) {
            return new OneToManyPluralAttributeElementSourceImpl(
                    pluralAttributeElement.getOneToMany(), container.getLocalBindingContext()
            );
        }
        else if ( pluralAttributeElement.getManyToMany() != null ) {
            return new ManyToManyPluralAttributeElementSourceImpl(
                    pluralAttributeElement.getManyToMany(), container.getLocalBindingContext()
            );
        }
        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()
            );
        }
    }
项目:lams    文件:TemporalTypeResolver.java   
@Override
public String resolveHibernateTypeName(AnnotationInstance temporalAnnotation) {

    if ( isTemporalType( mappedAttribute.getAttributeType() ) ) {
        if ( temporalAnnotation == null ) {
            //SPEC 11.1.47 The Temporal annotation must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.
            throw new AnnotationException( "Attribute " + mappedAttribute.getName() + " is a Temporal type, but no @Temporal annotation found." );
        }
        TemporalType temporalType = JandexHelper.getEnumValue( temporalAnnotation, "value", TemporalType.class );
        boolean isDate = Date.class.isAssignableFrom( mappedAttribute.getAttributeType() );
        String type;
        switch ( temporalType ) {
            case DATE:
                type = isDate ? StandardBasicTypes.DATE.getName() : StandardBasicTypes.CALENDAR_DATE.getName();
                break;
            case TIME:
                type = StandardBasicTypes.TIME.getName();
                if ( !isDate ) {
                    throw new NotYetImplementedException( "Calendar cannot persist TIME only" );
                }
                break;
            case TIMESTAMP:
                type = isDate ? StandardBasicTypes.TIMESTAMP.getName() : StandardBasicTypes.CALENDAR.getName();
                break;
            default:
                throw new AssertionFailure( "Unknown temporal type: " + temporalType );
        }
        return type;
    }
    else {
        if ( temporalAnnotation != null ) {
            throw new AnnotationException(
                    "@Temporal should only be set on a java.util.Date or java.util.Calendar property: " + mappedAttribute
                            .getName()
            );
        }
    }
    return null;
}
项目:hibernate-semantic-query    文件:OrmHelper.java   
private static void populateDatabaseModel(MetadataImplementor metadata, ExplicitSqmDomainMetamodel domainMetamodel) {
        final Database database = metadata.getDatabase();
        final DatabaseModelImpl databaseModel = (DatabaseModelImpl) domainMetamodel.getDatabaseModel();

        // todo : apply PhysicalNamingStrategy here, rather than as we create the "mapping model"?

        // todo : we need DatabaseModel to incorporate catalogs/schemas in some fashion
        //      either like org.hibernate.boot.model.relational.Database does
        //      or via catalogs/schemas-specific names
        for ( Namespace namespace : database.getNamespaces() ) {
            for ( Table mappingTable : namespace.getTables() ) {
                // todo : incorporate mapping Table's isAbstract indicator
                final org.hibernate.orm.persister.common.spi.Table table;
                if ( mappingTable instanceof DenormalizedTable ) {
                    // this is akin to a UnionSubclassTable
                    throw new NotYetImplementedException( "DenormalizedTable support not yet implemented" );
                }
                else if ( mappingTable.getSubselect() != null ) {
                    table = new DerivedTable( mappingTable.getSubselect() );
                }
                else {
//                  final JdbcEnvironment jdbcEnvironment = sessionFactory.getJdbcServices().getJdbcEnvironment();
//                  final String qualifiedTableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
//                          mappingTable.getQualifiedTableName(),
//                          jdbcEnvironment.getDialect()
//                  );
                    final String qualifiedTableName = mappingTable.getQualifiedTableName().render();
                    table = new PhysicalTable( qualifiedTableName );
                }

                databaseModel.registerTable( table );
            }
        }
    }
项目:lams    文件:QueryBinder.java   
public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, Mappings mappings) {
    if ( queryAnn == null ) return;
    //ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
    if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
        throw new AnnotationException( "A named query must have a name when used in class or package level" );
    }
    NamedSQLQueryDefinition query;
    String resultSetMapping = queryAnn.resultSetMapping();
    if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
        //sql result set usage
        query = new NamedSQLQueryDefinitionBuilder().setName( queryAnn.name() )
                .setQuery( queryAnn.query() )
                .setResultSetRef( resultSetMapping )
                .setQuerySpaces( null )
                .setCacheable( queryAnn.cacheable() )
                .setCacheRegion(
                        BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ?
                                null :
                                queryAnn.cacheRegion()
                )
                .setTimeout( queryAnn.timeout() < 0 ? null : queryAnn.timeout() )
                .setFetchSize( queryAnn.fetchSize() < 0 ? null : queryAnn.fetchSize() )
                .setFlushMode( getFlushMode( queryAnn.flushMode() ) )
                .setCacheMode( getCacheMode( queryAnn.cacheMode() ) )
                .setReadOnly( queryAnn.readOnly() )
                .setComment( BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment() )
                .setParameterTypes( null )
                .setCallable( queryAnn.callable() )
                .createNamedQueryDefinition();
    }
    else if ( !void.class.equals( queryAnn.resultClass() ) ) {
        //class mapping usage
        //FIXME should be done in a second pass due to entity name?
        final NativeSQLQueryRootReturn entityQueryReturn =
                new NativeSQLQueryRootReturn( "alias1", queryAnn.resultClass().getName(), new HashMap(), LockMode.READ );
        query = new NamedSQLQueryDefinitionBuilder().setName( queryAnn.name() )
                .setQuery( queryAnn.query() )
                .setQueryReturns( new NativeSQLQueryReturn[] {entityQueryReturn} )
                .setQuerySpaces( null )
                .setCacheable( queryAnn.cacheable() )
                .setCacheRegion(
                        BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ?
                                null :
                                queryAnn.cacheRegion()
                )
                .setTimeout( queryAnn.timeout() < 0 ? null : queryAnn.timeout() )
                .setFetchSize( queryAnn.fetchSize() < 0 ? null : queryAnn.fetchSize() )
                .setFlushMode( getFlushMode( queryAnn.flushMode() ) )
                .setCacheMode( getCacheMode( queryAnn.cacheMode() ) )
                .setReadOnly( queryAnn.readOnly() )
                .setComment( BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment() )
                .setParameterTypes( null )
                .setCallable( queryAnn.callable() )
                .createNamedQueryDefinition();
    }
    else {
        throw new NotYetImplementedException( "Pure native scalar queries are not yet supported" );
    }
    mappings.addSQLQuery( query.getName(), query );
    if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "Binding named native query: %s => %s", query.getName(), queryAnn.query() );
    }
}
项目:lams    文件:Binder.java   
private BasicAttributeBinding doBasicSingularAttributeBindingCreation(
        SingularAttributeSource attributeSource,
        AttributeBindingContainer attributeBindingContainer) {
    final SingularAttribute existingAttribute = attributeBindingContainer.getAttributeContainer()
            .locateSingularAttribute( attributeSource.getName() );
    final SingularAttribute attribute;
    if ( existingAttribute != null ) {
        attribute = existingAttribute;
    }
    else if ( attributeSource.isVirtualAttribute() ) {
        attribute = attributeBindingContainer.getAttributeContainer().createVirtualSingularAttribute(
                attributeSource.getName()
        );
    }
    else {
        attribute = attributeBindingContainer.getAttributeContainer()
                .createSingularAttribute( attributeSource.getName() );
    }

    final BasicAttributeBinding attributeBinding;
    if ( attributeSource.getNature() == SingularAttributeNature.BASIC ) {
        attributeBinding = attributeBindingContainer.makeBasicAttributeBinding( attribute );
        resolveTypeInformation( attributeSource.getTypeInformation(), attributeBinding );
    }
    else if ( attributeSource.getNature() == SingularAttributeNature.MANY_TO_ONE ) {
        attributeBinding = attributeBindingContainer.makeManyToOneAttributeBinding( attribute );
        resolveTypeInformation( attributeSource.getTypeInformation(), attributeBinding );
        resolveToOneInformation(
                (ToOneAttributeSource) attributeSource,
                (ManyToOneAttributeBinding) attributeBinding
        );
    }
    else {
        throw new NotYetImplementedException();
    }

    attributeBinding.setGeneration( attributeSource.getGeneration() );
    attributeBinding.setLazy( attributeSource.isLazy() );
    attributeBinding.setIncludedInOptimisticLocking( attributeSource.isIncludedInOptimisticLocking() );

    attributeBinding.setPropertyAccessorName(
            Helper.getPropertyAccessorName(
                    attributeSource.getPropertyAccessorName(),
                    false,
                    currentBindingContext.getMappingDefaults().getPropertyAccessorName()
            )
    );

    bindRelationalValues( attributeSource, attributeBinding );

    attributeBinding.setMetaAttributeContext(
            buildMetaAttributeContext(
                    attributeSource.metaAttributes(),
                    attributeBindingContainer.getMetaAttributeContext()
            )
    );

    return attributeBinding;
}
项目:lams    文件:AbstractAttributeContainer.java   
@Override
public SingularAttribute createVirtualSingularAttribute(String name) {
    throw new NotYetImplementedException();
}
项目:lams    文件:ResultSetProcessorImpl.java   
@Override
public ScrollableResultSetProcessor toOnDemandForm() {
    // todo : implement
    throw new NotYetImplementedException();
}
项目:lams    文件:EntityMetamodel.java   
public GenerationStrategyPair buildPair() {
    if ( hadInMemoryGeneration && hadInDatabaseGeneration ) {
        throw new ValueGenerationStrategyException(
                "Composite attribute [" + mappingProperty.getName() + "] contained both in-memory"
                        + " and in-database value generation"
        );
    }
    else if ( hadInMemoryGeneration ) {
        throw new NotYetImplementedException( "Still need to wire in composite in-memory value generation" );

    }
    else if ( hadInDatabaseGeneration ) {
        final Component composite = (Component) mappingProperty.getValue();

        // we need the numbers to match up so we can properly handle 'referenced sql column values'
        if ( inDatabaseStrategies.size() != composite.getPropertySpan() ) {
            throw new ValueGenerationStrategyException(
                    "Internal error : mismatch between number of collected in-db generation strategies" +
                            " and number of attributes for composite attribute : " + mappingProperty.getName()
            );
        }

        // the base-line values for the aggregated InDatabaseValueGenerationStrategy we will build here.
        GenerationTiming timing = GenerationTiming.INSERT;
        boolean referenceColumns = false;
        String[] columnValues = new String[ composite.getColumnSpan() ];

        // start building the aggregate values
        int propertyIndex = -1;
        int columnIndex = 0;
        Iterator subProperties = composite.getPropertyIterator();
        while ( subProperties.hasNext() ) {
            propertyIndex++;
            final Property subProperty = (Property) subProperties.next();
            final InDatabaseValueGenerationStrategy subStrategy = inDatabaseStrategies.get( propertyIndex );

            if ( subStrategy.getGenerationTiming() == GenerationTiming.ALWAYS ) {
                // override the base-line to the more often "ALWAYS"...
                timing = GenerationTiming.ALWAYS;

            }
            if ( subStrategy.referenceColumnsInSql() ) {
                // override base-line value
                referenceColumns = true;
            }
            if ( subStrategy.getReferencedColumnValues() != null ) {
                if ( subStrategy.getReferencedColumnValues().length != subProperty.getColumnSpan() ) {
                    throw new ValueGenerationStrategyException(
                            "Internal error : mismatch between number of collected 'referenced column values'" +
                                    " and number of columns for composite attribute : " + mappingProperty.getName() +
                                    '.' + subProperty.getName()
                    );
                }
                System.arraycopy(
                        subStrategy.getReferencedColumnValues(),
                        0,
                        columnValues,
                        columnIndex,
                        subProperty.getColumnSpan()
                );
            }
        }

        // then use the aggregated values to build the InDatabaseValueGenerationStrategy
        return new GenerationStrategyPair(
                new InDatabaseValueGenerationStrategyImpl( timing, referenceColumns, columnValues )
        );
    }
    else {
        return NO_GEN_PAIR;
    }
}
项目:lams    文件:ProcedureCallImpl.java   
@Override
public Type[] getReturnTypes() throws HibernateException {
    throw new NotYetImplementedException();
}
项目:stuffEngine    文件:HibernateDepartmentDao.java   
@Override
public List<Department> getLevelBelowSubDepts(Integer depId) {
    throw new NotYetImplementedException();
}
项目:hibernate-ogm-ignite    文件:IgnitePropertyHelper.java   
/**
     * Returns the {@link PropertyIdentifier} for the given property path.
     *
     * In passing, it creates all the necessary aliases for embedded/associations.
     *
     * @param entityType the type of the entity
     * @param propertyPath the path to the property without aliases
     * @return the {@link PropertyIdentifier}
     */
    public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath) {
        // we analyze the property path to find all the associations/embedded which are in the way and create proper
        // aliases for them
        String entityAlias = findAliasForType( entityType );

        String propertyEntityType = entityType;
        String propertyAlias = entityAlias;
        String propertyName;

        List<String> currentPropertyPath = new ArrayList<>();
        List<String> lastAssociationPath = Collections.emptyList();
        OgmEntityPersister currentPersister = getPersister( entityType );

        int requiredDepth = propertyPath.size();
        boolean isLastElementAssociation = false;
        int depth = 1;
        for ( String property : propertyPath ) {
            currentPropertyPath.add( property );
            Type currentPropertyType = getPropertyType( entityType, currentPropertyPath );

            // determine if the current property path is still part of requiredPropertyMatch
            boolean optionalMatch = depth > requiredDepth;

            if ( currentPropertyType.isAssociationType() ) {
                AssociationType associationPropertyType = (AssociationType) currentPropertyType;
                Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() );
                if ( associatedJoinable.isCollection()
                        && ( (OgmCollectionPersister) associatedJoinable ).getType().isComponentType() ) {
                    // we have a collection of embedded
                    throw new NotYetImplementedException();
//                  propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
                }
                else {
                    propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() );
                    currentPersister = getPersister( propertyEntityType );
                    String targetNodeType = currentPersister.getEntityKeyMetadata().getTable();

                    throw new NotYetImplementedException();
//                  propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch );
//                  lastAssociationPath = new ArrayList<>( currentPropertyPath );
//                  isLastElementAssociation = true;
                }
            }
            else if ( currentPropertyType.isComponentType()
                    && !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) {
                // we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal
                // properties)
                throw new NotYetImplementedException();
//              propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch );
            }
            else {
                isLastElementAssociation = false;
            }
            depth++;
        }
        if ( isLastElementAssociation ) {
            // even the last element is an association, we need to find a suitable identifier property
            propertyName = getSessionFactory().getEntityPersister( propertyEntityType ).getIdentifierPropertyName();
        }
        else {
            // the last element is a property so we can build the test with this property
            propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) );
        }
        return new PropertyIdentifier( propertyAlias, propertyName );
    }
项目:lams    文件:PropertyFactory.java   
/**
 * Generates a VersionProperty representation for an entity mapping given its
 * version mapping Property.
 *
 * @param property The version mapping Property.
 * @param lazyAvailable Is property lazy loading currently available.
 * @return The appropriate VersionProperty definition.
 */
public static VersionProperty buildVersionProperty(
        EntityPersister persister,
        BasicAttributeBinding property,
        boolean lazyAvailable) {
    throw new NotYetImplementedException();
}