@Override protected void collectTypes() throws IOException, XMLStreamException, ClassNotFoundException, NoSuchMethodException { Map<ManagedType<?>, EntityType> types = Maps.newHashMap(); for (ManagedType<?> managedType : configuration.getManagedTypes()) { if (managedType instanceof MappedSuperclassType) { types.put(managedType, createSuperType(managedType.getJavaType())); } else if (managedType instanceof javax.persistence.metamodel.EntityType) { types.put(managedType, createEntityType(managedType.getJavaType())); } else if (managedType instanceof EmbeddableType) { types.put(managedType, createEmbeddableType(managedType.getJavaType())); } else { throw new IllegalArgumentException("Unknown type " + managedType); } } // handle properties for (Map.Entry<ManagedType<?>, EntityType> entry : types.entrySet()) { EntityType entityType = entry.getValue(); for (Attribute<?,?> attribute : entry.getKey().getDeclaredAttributes()) { handleProperty(entityType, entityType.getJavaClass(), attribute); } } }
@Override protected void collectTypes() throws IOException, XMLStreamException, ClassNotFoundException, NoSuchMethodException { Map<ManagedType<?>, EntityType> types = Maps.newHashMap(); for (ManagedType<?> managedType : metamodel.getManagedTypes()) { if (managedType instanceof MappedSuperclassType) { types.put(managedType, createSuperType(managedType.getJavaType())); } else if (managedType instanceof javax.persistence.metamodel.EntityType) { types.put(managedType, createEntityType(managedType.getJavaType())); } else if (managedType instanceof EmbeddableType) { types.put(managedType, createEmbeddableType(managedType.getJavaType())); } else { throw new IllegalArgumentException("Unknown type " + managedType); } } // handle properties for (Map.Entry<ManagedType<?>, EntityType> entry : types.entrySet()) { EntityType entityType = entry.getValue(); for (Attribute<?,?> attribute : entry.getKey().getDeclaredAttributes()) { handleProperty(entityType, entityType.getJavaClass(), attribute); } } }
protected void buildPropertyList() throws ODataJPAModelException { for (final Attribute<?, ?> jpaAttribute : jpaManagedType.getDeclaredAttributes()) { final PersistentAttributeType attributeType = jpaAttribute.getPersistentAttributeType();
protected void buildNaviPropertyList() throws ODataJPAModelException { for (final Attribute<?, ?> jpaAttribute : jpaManagedType.getDeclaredAttributes()) { final PersistentAttributeType attributeType = jpaAttribute.getPersistentAttributeType();
public void initialize(Resources resources) { startMonitoring(); emf = Persistence.createEntityManagerFactory(persistenceUnitName, persistenceProperties); EntityManager em = null; try { em = emf.createEntityManager(); Metamodel meta = emf.getMetamodel(); meta.getManagedTypes().forEach(type -> { type.getDeclaredAttributes(); type.getPersistenceType(); }); } finally { if (em != null) em.close(); } NotificationCenter center = resources.getNotificationCenter(); center.subscribe(EvictCollectionRegion.class, notice -> evictCollectionRegion(notice.getUserObject())); center.subscribe(EvictEntityRegion.class, notice -> evictEntityRegion(notice.getUserObject())); center.subscribe(EvictEntity.class, notice -> evictEntity(notice.getUserObject())); }
this.getSession().log(SessionLog.FINER, SessionLog.METAMODEL, "metamodel_canonical_model_class_found", className); String fieldName = ""; for(Object attribute : manType.getDeclaredAttributes()) { try { fieldName = ((Attribute)attribute).getName();