Package org.hibernate.type

Examples of org.hibernate.type.ComponentType


              value = constr.newInstance(new Object[] { newValue.toString() });
            }

            if (propertyInEmbeddedKey(propertyName))
            {
              final ComponentType identifierType = (ComponentType) classMetadata.getIdentifierType();
              final String[] propertyNames = identifierType.getPropertyNames();

              for (int i = 0; i < propertyNames.length; i++)
              {
                String name = propertyNames[i];

                if (name.equals(propertyName))
                {
                  final Object identifier = classMetadata.getIdentifier(pojo, sessionImplementor);
                  final Object[] values = identifierType.getPropertyValues(identifier,
                      EntityMode.POJO);

                  values[i] = value;
                  identifierType.setPropertyValues(identifier, values, EntityMode.POJO);
                }
              }
            }
            else
            {
View Full Code Here


      {
        logger.executionTrace();

        if (propertyInEmbeddedKey(propertyName))
        {
          final ComponentType idType = (ComponentType) classMetadata.getIdentifierType();
          final String[] propertyNames = idType.getPropertyNames();

          for (String name : propertyNames)
          {
            if (name.equals(propertyName))
            {
View Full Code Here

  this.persister = persister;
  if (!persister.getElementType().isComponentType()) {
      throw new IllegalArgumentException("persister for role "+persister.getRole()+" is not a collection-of-component");
  }

  ComponentType componentType = (ComponentType)persister.getElementType();
  String[] names = componentType.getPropertyNames();
  Type[] types = componentType.getSubtypes();

  for (int i = 0; i < names.length; i++) {
      subTypes.put(names[i], types[i]);
  }
View Full Code Here

    // the current "WHERE COL = ?" (fails for null for most DBs).  Note that
    // the param would have to be bound twice.  Until we eventually add "parameter bind points" concepts to the
    // AST in ORM 5+, handling this type of condition is either extremely difficult or impossible.  Forcing
    // recreation isn't ideal, but not really any other option in ORM 4.
    if (persister.getElementType() instanceof ComponentType) {
      ComponentType componentType = (ComponentType) persister.getElementType();
      return !componentType.hasNotNullProperty();
    }
    return false;
  }
View Full Code Here

        );
        processingState.registerIdentifierHydratedForm( entityKey.getIdentifier() );
        processingState.registerEntityKey( entityKey );
        final EntityPersister entityPersister = processingState.getEntityReference().getEntityPersister();
        if ( entityPersister.getIdentifierType().isComponentType()  ) {
          final ComponentType identifierType = (ComponentType) entityPersister.getIdentifierType();
          if ( !identifierType.isEmbedded() ) {
            addKeyManyToOnesToSession(
                context,
                identifierType,
                entityKey.getIdentifier()
            );
View Full Code Here

        );
        processingState.registerIdentifierHydratedForm( entityKey.getIdentifier() );
        processingState.registerEntityKey( entityKey );
        final EntityPersister entityPersister = processingState.getEntityReference().getEntityPersister();
        if ( entityPersister.getIdentifierType().isComponentType()  ) {
          final ComponentType identifierType = (ComponentType) entityPersister.getIdentifierType();
          if ( !identifierType.isEmbedded() ) {
            addKeyManyToOnesToSession(
                context,
                identifierType,
                entityKey.getIdentifier()
            );
View Full Code Here

    // the current "WHERE COL = ?" (fails for null for most DBs).  Note that
    // the param would have to be bound twice.  Until we eventually add "parameter bind points" concepts to the
    // AST in ORM 5+, handling this type of condition is either extremely difficult or impossible.  Forcing
    // recreation isn't ideal, but not really any other option in ORM 4.
    if (persister.getElementType() instanceof ComponentType) {
      ComponentType componentType = (ComponentType) persister.getElementType();
      return !componentType.hasNotNullProperty();
    }
    return false;
  }
View Full Code Here

        else if (Arrays.asList(meta.getPropertyNames()).contains(foreignKeyName))
            id = meta.getPropertyValue(entity, foreignKeyName);
        else if (meta.getIdentifierType().isComponentType())
        {
            // compound key
          ComponentType compType = (ComponentType) meta.getIdentifierType();
          int index = Arrays.asList(compType.getPropertyNames()).indexOf(foreignKeyName);
            if (index >= 0)
            {
                Object idComp = meta.getIdentifier(entity, null);
                id = compType.getPropertyValue(idComp, index, EntityMode.POJO);
            }
        }

        if (id == null && entityInfo.entityState == EntityState.Deleted)
        {
View Full Code Here

    Type idType = meta.getIdentifierType();
    if (idType != null) {
      Serializable id = meta.getIdentifier(entity, null);
      if (idType.isComponentType()) {
        ComponentType compType = (ComponentType) idType;
        return compType.getPropertyValues(id, EntityMode.POJO);
      } else {
        return id;
      }
    } else if (meta.hasNaturalIdentifier()) {
      int[] idprops = meta.getNaturalIdentifierProperties();
View Full Code Here

  this.persister = persister;
  if (!persister.getElementType().isComponentType()) {
      throw new IllegalArgumentException("persister for role "+persister.getRole()+" is not a collection-of-component");
  }

  ComponentType componentType = (ComponentType)persister.getElementType();
  String[] names = componentType.getPropertyNames();
  Type[] types = componentType.getSubtypes();

  for (int i = 0; i < names.length; i++) {
      subTypes.put(names[i], types[i]);
  }
View Full Code Here

TOP

Related Classes of org.hibernate.type.ComponentType

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.