Examples of IdClass


Examples of org.apache.openejb.jee.jpa.IdClass

  }

  @SuppressWarnings("unchecked") //$NON-NLS-1$
  private void addIdClassAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
    try {
      IdClass idClass = entity.getIdClass();
      if (idClass == null) {
        return;
      }
      String cls = idClass.getClazz();
      Map props = new HashMap();
      props.put("value", cls); //$NON-NLS-1$
      facade.addClassAnnotation(entityBean.getEjbClass(), javax.persistence.IdClass.class, props);
    } catch (Exception e) {
      String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.persistence.IdClass", entityBean.getEjbClass());
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

            primaryKeyFields.add(fieldName);
        } else if (bean.getPrimKeyClass() != null) {
            Class<?> pkClass = null;
            try {
                pkClass = classLoader.loadClass(bean.getPrimKeyClass());
                mapping.setIdClass(new IdClass(bean.getPrimKeyClass()));
                for (java.lang.reflect.Field pkField : pkClass.getFields()) {
                    String pkFieldName = pkField.getName();
                    int modifiers = pkField.getModifiers();
                    if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers) && allFields.contains(pkFieldName)) {
                        Field field = new Id(pkFieldName);
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

                        mapping.addField(new AttributeOverride(fieldName));
                        primaryKeyFields.add(fieldName);
                    }
                }
                if (superclass != null) {
                    superclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (ClassNotFoundException e) {
                // todo throw exception
            }
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

                        primaryKeyFields.add(pkFieldName);
                    }
                }
                // if we've located an ID class, set it as such
                if (idclass != null) {
                    idclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                } else {
                    // do this for the toplevel mapping
                    mapping.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (final ClassNotFoundException e) {
                throw (IllegalStateException) new IllegalStateException("Could not find entity primary key class " + bean.getPrimKeyClass()).initCause(e);
            }
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

                    }
                }

                // if we've located an ID class, set it as such
                if (idclass != null) {
                    idclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (final ClassNotFoundException e) {
                throw (IllegalStateException) new IllegalStateException("Could not find entity primary key class " + bean.getPrimKeyClass()).initCause(e);
            }
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

                        primaryKeyFields.add(pkFieldName);
                    }
                }
                // if we've located an ID class, set it as such
                if (idclass != null) {
                    idclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                } else {
                    // do this for the toplevel mapping
                    mapping.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (final ClassNotFoundException e) {
                throw (IllegalStateException) new IllegalStateException("Could not find entity primary key class " + bean.getPrimKeyClass()).initCause(e);
            }
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.IdClass

                    }
                }

                // if we've located an ID class, set it as such
                if (idclass != null) {
                    idclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (final ClassNotFoundException e) {
                throw (IllegalStateException) new IllegalStateException("Could not find entity primary key class " + bean.getPrimKeyClass()).initCause(e);
            }
        }
View Full Code Here

Examples of org.jboss.test.cmp2.enums.ejb.IDClass

   public void testColorEnum()
      throws Exception
   {
      Facade facade = FacadeUtil.getHome().create();
      IDClass childId = new IDClass(1);
      facade.createChild(childId);
      assertTrue(ColorEnum.RED == facade.getColorForId(childId));
      facade.setColor(childId, ColorEnum.GREEN);
      assertTrue(ColorEnum.GREEN == facade.getColorForId(childId));
      facade.setColor(childId, ColorEnum.BLUE);
View Full Code Here

Examples of org.jboss.test.cmp2.enums.ejb.IDClass

   public void testAnimalEnum()
      throws Exception
   {
      Facade facade = FacadeUtil.getHome().create();
      IDClass childId = new IDClass(2);
      facade.createChild(childId);
      assertTrue(AnimalEnum.PENGUIN == facade.getAnimalForId(childId));
      facade.setAnimal(childId, AnimalEnum.DOG);
      assertTrue(AnimalEnum.DOG == facade.getAnimalForId(childId));
      facade.setAnimal(childId, AnimalEnum.CAT);
View Full Code Here

Examples of org.jboss.test.cmp2.enums.ejb.IDClass

   public void testFindByColor()
      throws Exception
   {
      Facade facade = FacadeUtil.getHome().create();
      IDClass childId = new IDClass(3);
      facade.createChild(childId);
      try
      {
         facade.setColor(childId, ColorEnum.BLUE);
         IDClass id = facade.findByColor(ColorEnum.BLUE);
         assertEquals(childId, id);
      }
      finally
      {
         facade.removeChild(childId);
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.