Package org.apache.openejb.jee.jpa

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


                        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

  }

  @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

            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

                        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

                        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

                    }
                }

                // 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

                        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

                    }
                }

                // 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

TOP

Related Classes of org.apache.openejb.jee.jpa.IdClass

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.