Examples of DynamicType


Examples of org.eclipse.persistence.dynamic.DynamicType

    EntityManager em = getEntityManager();
    try {
      Class       clazz = entity.getClass();
      String      id    = getIdFieldName(clazz);
      DynamicType type  = getDynamicEntityType(clazz);

      if (type != null) {
        try {
          Map<String, Object> properties    = getEntityProperties(entity);
          DynamicEntity       dynamicEntity = em.getReference(type.getJavaClass(), properties.get(id));

          if (dynamicEntity != null) {
            em.getTransaction().begin();
            try {
              em.remove(dynamicEntity);
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

    checkInitialize();

    EntityManager em = getEntityManager();
    try {
      DynamicEntity dynamicEntity = null;
      DynamicType   type          = getDynamicEntityType(clazz);

      if (type != null) {
        dynamicEntity = em.find(type.getJavaClass(), primaryKey);
      }
      return dynamicEntity == null ? null : toEntity(clazz, type, dynamicEntity);
    } catch (Exception e) {
      throwPersistenceException("Caught exception trying to find " +
          clazz.getName() + " where key=" + primaryKey, e);
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

    checkInitialize();

    EntityManager em = getEntityManager();
    try {
      Collection<T> resources = new HashSet<T>();
      DynamicType   type      = getDynamicEntityType(clazz);

      if (type != null) {
        try {
          Query query = em.createQuery(getSelectStatement(clazz, whereClause));
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

            if (refEntityName == null) {
              typeBuilder.addDirectCollectionMapping(propertyName, tableName, propertyName,
                  parameterizedTypeClass, entityMap.get(entityName).getIdProperty());
            } else {
              DynamicType refType = typeBuilderMap.get(refEntityName).getType();
              typeBuilder.addManyToManyMapping(propertyName, refType, tableName);
            }
          }
        } else {
          DynamicType refType = typeBuilderMap.get(refEntityName).getType();
          typeBuilder.addOneToOneMapping(propertyName, refType, propertyName);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

    Class         clazz          = entity.getClass();
    String        id             = getIdFieldName(clazz);

    Map<String, Object> properties = getEntityProperties(entity);

    DynamicType type = getDynamicEntityType(clazz);

    if (type != null) {
      dynamicEntity  = em.find(type.getJavaClass(), properties.get(id));

      boolean create = dynamicEntity == null;

      if (create) {
        dynamicEntity = type.newDynamicEntity();
      }

      // has this entity already been accounted for?
      if (persistSet.contains(dynamicEntity)) {
        return dynamicEntity;
      }

      persistSet.add(dynamicEntity);

      for (String propertyName : type.getPropertiesNames()) {
        if (properties.containsKey(propertyName)) {
          Object value = properties.get(propertyName);
          if (value != null) {
            Class<?> valueClass = value.getClass();
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

     *
     * @return Dynamic type of this entity
     * @throws DynamicException if type is null
     */
    public DynamicTypeImpl getType() throws DynamicException {
        DynamicType type = fetchPropertiesManager().getType();
        if (type == null) {
            throw DynamicException.entityHasNullType(this);
        }
        return (DynamicTypeImpl)type;
    }
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

        try{
            entity = helper.newDynamicEntity(type);
        } catch (IllegalArgumentException e){
            ClassDescriptor descriptor = getDescriptor(type);
            if (descriptor != null){
                DynamicType jaxbType = (DynamicType) descriptor.getProperty(DynamicType.DESCRIPTOR_PROPERTY);
                if (jaxbType != null){
                    return jaxbType.newDynamicEntity();
                }
            }
            JPARSLogger.fine("exception_thrown_while_creating_dynamic_entity", new Object[]{type, e.toString()});
            throw e;
        }
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

        try{
            entity = helper.newDynamicEntity(type);
        } catch (IllegalArgumentException e){
            ClassDescriptor descriptor = getDescriptor(type);
            if (descriptor != null){
                DynamicType jaxbType = (DynamicType) descriptor.getProperty(DynamicType.DESCRIPTOR_PROPERTY);
                if (jaxbType != null){
                    return jaxbType.newDynamicEntity();
                }
            }
            JPARSLogger.fine("exception_thrown_while_creating_dynamic_entity", new Object[]{type, e.toString()});
            throw e;
        }
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

     * @return
     *      The <tt>DynamicType</tt> for this Java class name.
     */
    public DynamicType getDynamicType(String javaName) {
        for (DynamicHelper helper : this.helpers) {
            DynamicType type = helper.getType(javaName);
            if (type != null) {
                return type;
            }
        }
        return null;
View Full Code Here

Examples of org.eclipse.persistence.dynamic.DynamicType

     *
     * @return Dynamic type of this entity
     * @throws DynamicException if type is null
     */
    public DynamicTypeImpl getType() throws DynamicException {
        DynamicType type = fetchPropertiesManager().getType();
        if (type == null) {
            throw DynamicException.entityHasNullType(this);
        }
        return (DynamicTypeImpl)type;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.