congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ClassMetadata.setPropertyValue
Code IndexAdd Tabnine to your IDE (free)

How to use
setPropertyValue
method
in
org.hibernate.metadata.ClassMetadata

Best Java code snippets using org.hibernate.metadata.ClassMetadata.setPropertyValue (Showing top 11 results out of 315)

origin: org.geomajas.plugin/geomajas-layer-hibernate

@Override
public void setAttribute(String name, Object value) throws LayerException {
  metadata.setPropertyValue(object, name, value, EntityMode.POJO);
}
origin: org.geomajas.plugin/geomajas-layer-hibernate

@Override
public void setChild(String name, Entity entity) throws LayerException {
  if (entity != null) {
    metadata.setPropertyValue(object, name, ((HibernateEntity) entity).getObject(), EntityMode.POJO);
  } else {
    metadata.setPropertyValue(object, name, null, EntityMode.POJO);
  }
}
origin: org.geomajas.plugin/geomajas-layer-hibernate

@Override
public void removeEntity(Entity entity) throws LayerException {
  Object object = ((HibernateEntity) entity).getObject();
  // remove parent from many-to-one
  if (parentName != null) {
    metadata.setPropertyValue(object, parentName, null, EntityMode.POJO);
  }
  objects.remove(object);
}
origin: org.geomajas.plugin/geomajas-layer-hibernate

@Override
@SuppressWarnings("unchecked")
public void addEntity(Entity entity) throws LayerException {
  Object object = ((HibernateEntity) entity).getObject();
  // assign parent to many-to-one
  if (parentName != null) {
    metadata.setPropertyValue(object, parentName, parent, EntityMode.POJO);
  }
  objects.add(object);
}
origin: com.atlassian.hibernate/hibernate.adapter

@Override
public void setPropertyValue(final Object object, final String propertyName, final Object value) throws HibernateException {
  metadata.setPropertyValue(PropertyValueAdapter.adaptToV5(object), propertyName, value);
}
origin: com.arsframework/ars-database

  metadata.setPropertyValue(object, property, value);
} else if (type.isCollectionType()) { // 多对多
  Object[] values = Beans.toArray(Object.class, value);
  metadata.setPropertyValue(object, property, objects);
metadata.setPropertyValue(object, property, Beans.toObject(meta, value));
origin: com.quhaodian/hibernate_common

/**
 * 将更新对象拷贝至实体对象,并处理many-to-one的更新。
 *
 * @param updater
 * @param po
 */
private void updaterCopyToPersistentObject(Updater<T> updater, T po, ClassMetadata cm) {
  String[] propNames = cm.getPropertyNames();
  String identifierName = cm.getIdentifierPropertyName();
  T bean = updater.getBean();
  Object value;
  for (String propName : propNames) {
    if (propName.equals(identifierName)) {
      continue;
    }
    try {
      value = MyBeanUtils.getSimpleProperty(bean, propName);
      if (!updater.isUpdate(propName, value)) {
        continue;
      }
      cm.setPropertyValue(po, propName, value);
    } catch (Exception e) {
      throw new RuntimeException("copy property to persistent object failed: '" + propName + "'", e);
    }
  }
}
origin: com.haoxuer.discover/discover-common-hibernate

/**
 * 将更新对象拷贝至实体对象,并处理many-to-one的更新。
 *
 * @param updater
 * @param po
 */
private void updaterCopyToPersistentObject(Updater<T> updater, T po, ClassMetadata cm) {
 String[] propNames = cm.getPropertyNames();
 String identifierName = cm.getIdentifierPropertyName();
 T bean = updater.getBean();
 Object value;
 for (String propName : propNames) {
  if (propName.equals(identifierName)) {
   continue;
  }
  try {
   value = MyBeanUtils.getSimpleProperty(bean, propName);
   if (!updater.isUpdate(propName, value)) {
    continue;
   }
   cm.setPropertyValue(po, propName, value);
  } catch (Exception e) {
   throw new RuntimeException("copy property to persistent object failed: '" + propName + "'", e);
  }
 }
}
origin: com.quhaodian.discover/discover-hibernate-common

/**
 * 将更新对象拷贝至实体对象,并处理many-to-one的更新。
 *
 * @param updater
 * @param po
 */
private void updaterCopyToPersistentObject(Updater<T> updater, T po, ClassMetadata cm) {
 String[] propNames = cm.getPropertyNames();
 String identifierName = cm.getIdentifierPropertyName();
 T bean = updater.getBean();
 Object value;
 for (String propName : propNames) {
  if (propName.equals(identifierName)) {
   continue;
  }
  try {
   value = MyBeanUtils.getSimpleProperty(bean, propName);
   if (!updater.isUpdate(propName, value)) {
    continue;
   }
   cm.setPropertyValue(po, propName, value);
  } catch (Exception e) {
   throw new RuntimeException("copy property to persistent object failed: '" + propName + "'", e);
  }
 }
}
 
origin: riotfamily/riot

private Object createIndex(Content content) {
  ContentContainer container = content.getContainer();
  if (container != null) {
    Object owner = container.getOwner();
    if (owner != null) {
      String ownerClassName = Hibernate.getClass(owner).getName();
      ClassMetadata meta = getIndexClassMetadata(ownerClassName);
      if (meta != null) {
        ContentIndex index = (ContentIndex) meta.instantiate(content.getId(), (SessionImplementor) sessionFactory.getCurrentSession());
        String ownerProperty = StringUtils.uncapitalize(StringUtils.unqualify(ownerClassName));
        meta.setPropertyValue(index, ownerProperty, owner);
        index.setContent(content);                    
        return index;
      }
    }
  }
  return null;
}
  
origin: org.geomajas.plugin/geomajas-layer-hibernate

@Override
public EntityCollection getChildCollection(String name) throws LayerException {
  Type type = metadata.getPropertyType(name);
  if (type instanceof CollectionType) {
    CollectionType ct = (CollectionType) type;
    Collection coll = (Collection) metadata.getPropertyValue(object, name, EntityMode.POJO);
    if (coll == null) {
      // normally should not happen, hibernate instantiates it automatically
      coll = (Collection) ct.instantiate(0);
      metadata.setPropertyValue(object, name, coll, EntityMode.POJO);
    }
    String entityName = ct.getAssociatedEntityName((SessionFactoryImplementor) sessionFactory);
    ClassMetadata childMetadata = sessionFactory.getClassMetadata(entityName);
    return new HibernateEntityCollection(metadata, childMetadata, object, coll);
  } else {
    throw new LayerException(ExceptionCode.FEATURE_MODEL_PROBLEM);
  }
}
org.hibernate.metadataClassMetadatasetPropertyValue

Javadoc

Set the value of a particular (named) property

Popular methods of ClassMetadata

  • getIdentifierPropertyName
    Get the name of the identifier property (or return null)
  • getIdentifierType
    Get the identifier Hibernate type
  • getEntityName
    The name of the entity
  • getPropertyNames
    Get the names of the class' persistent properties
  • getMappedClass
    The persistent class, or null
  • getIdentifier
  • getPropertyType
    Get the type of a particular (named) property
  • getPropertyTypes
    Get the Hibernate types of the class properties
  • getPropertyValue
    Get the value of a particular (named) property
  • getPropertyValues
    Extract the property values from the given entity.
  • hasIdentifierProperty
    Does this class have an identifier property?
  • instantiate
  • hasIdentifierProperty,
  • instantiate,
  • getVersionProperty,
  • setIdentifier,
  • getPropertyNullability,
  • getVersion,
  • isVersioned,
  • getNaturalIdentifierProperties,
  • getPropertyLaziness

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSharedPreferences (Context)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • String (java.lang)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now