public PersistenceElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) { super(member, pd); PersistenceContext pc = ae.getAnnotation(PersistenceContext.class); PersistenceUnit pu = ae.getAnnotation(PersistenceUnit.class); Class<?> resourceType = EntityManager.class; if (pc != null) { if (pu != null) { throw new IllegalStateException("Member may only be annotated with either " + "@PersistenceContext or @PersistenceUnit, not both: " + member); } Properties properties = null; PersistenceProperty[] pps = pc.properties(); if (!ObjectUtils.isEmpty(pps)) { properties = new Properties(); for (PersistenceProperty pp : pps) { properties.setProperty(pp.name(), pp.value()); } } this.unitName = pc.unitName(); this.type = pc.type(); this.synchronizedWithTransaction = SynchronizationType.SYNCHRONIZED.equals(pc.synchronization()); this.properties = properties; } else { resourceType = EntityManagerFactory.class; this.unitName = pu.unitName(); } checkResourceType(resourceType); }
public PersistenceElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) { super(member, pd); PersistenceContext pc = ae.getAnnotation(PersistenceContext.class); PersistenceUnit pu = ae.getAnnotation(PersistenceUnit.class); Class<?> resourceType = EntityManager.class; if (pc != null) { if (pu != null) { throw new IllegalStateException("Member may only be annotated with either " + "@PersistenceContext or @PersistenceUnit, not both: " + member); } Properties properties = null; PersistenceProperty[] pps = pc.properties(); if (!ObjectUtils.isEmpty(pps)) { properties = new Properties(); for (PersistenceProperty pp : pps) { properties.setProperty(pp.name(), pp.value()); } } this.unitName = pc.unitName(); this.type = pc.type(); this.synchronizedWithTransaction = SynchronizationType.SYNCHRONIZED.equals(pc.synchronization()); this.properties = properties; } else { resourceType = EntityManagerFactory.class; this.unitName = pu.unitName(); } checkResourceType(resourceType); }
public Map<String, String> properties() { final Map<String, String> properties = new LinkedHashMap<String, String>(); for (final PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value()); } return properties; }
public Map<String, String> properties() { Map<String, String> properties = new LinkedHashMap<String, String>(); for (PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value()); } return properties; }
public Map<String, String> properties() { final Map<String, String> properties = new LinkedHashMap<String, String>(); for (final PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value()); } return properties; }
private static Properties getPropertiesFromPersistenceContext(InjectionPoint injectionPoint) { PersistenceContext persistenceContext = injectionPoint.getAnnotated().getAnnotation(PersistenceContext.class); if (persistenceContext != null) { Properties properties = new Properties(); for (PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value()); } return properties; } return null; }
private static Properties getPropertiesFromPersistenceContext(InjectionPoint injectionPoint) { PersistenceContext persistenceContext = injectionPoint.getAnnotated().getAnnotation(PersistenceContext.class); if (persistenceContext != null) { Properties properties = new Properties(); for (PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value()); } return properties; } return null; }
for (PersistenceProperty aProp : aContext.properties()) { aMap.put(aProp.name(), aProp.value());
PersistenceContextGenerator(String location, PersistenceContext pc) { _location = location; _jndiName = pc.name(); _unitName = pc.unitName(); _type = pc.type(); _properties = new HashMap(); PersistenceProperty[] propertyList = pc.properties(); for (int i = 0; propertyList != null && i < propertyList.length; i++) { PersistenceProperty prop = propertyList[i]; _properties.put(prop.name(), prop.value()); } }
public PersistenceElement(Member member, AnnotatedElement ae, @Nullable PropertyDescriptor pd) { super(member, pd); PersistenceContext pc = ae.getAnnotation(PersistenceContext.class); PersistenceUnit pu = ae.getAnnotation(PersistenceUnit.class); Class<?> resourceType = EntityManager.class; if (pc != null) { if (pu != null) { throw new IllegalStateException("Member may only be annotated with either " + "@PersistenceContext or @PersistenceUnit, not both: " + member); } Properties properties = null; PersistenceProperty[] pps = pc.properties(); if (!ObjectUtils.isEmpty(pps)) { properties = new Properties(); for (PersistenceProperty pp : pps) { properties.setProperty(pp.name(), pp.value()); } } this.unitName = pc.unitName(); this.type = pc.type(); this.synchronizedWithTransaction = SynchronizationType.SYNCHRONIZED.equals(pc.synchronization()); this.properties = properties; } else { resourceType = EntityManagerFactory.class; this.unitName = pu.unitName(); } checkResourceType(resourceType); }
if(persistenceContext.properties() != null && persistenceContext.properties().length != 0) { properties = new HashMap<>(); for(PersistenceProperty property : persistenceContext.properties()) { properties.put(property.name(), property.value());
private void processNewEmRefAnnotation (EntityManagerReferenceDescriptor emRef, String logicalName, PersistenceContext annotation) { emRef.setName(logicalName); if( !(annotation.unitName().equals("")) ) { emRef.setUnitName(annotation.unitName()); } emRef.setPersistenceContextType(annotation.type()); // Add each property from annotation to descriptor, unless // it has been overridden within the .xml. Map existingProperties = emRef.getProperties(); for(PersistenceProperty next : annotation.properties()) { if( !existingProperties.containsKey(next.name()) ) { emRef.addProperty(next.name(), next.value()); } } }
PersistenceProperty[] properties = annotation.properties(); for (PersistenceProperty property : properties) { Property prop = new Property();
private void processNewEmRefAnnotation (EntityManagerReferenceDescriptor emRef, String logicalName, PersistenceContext annotation) { emRef.setName(logicalName); if( !(annotation.unitName().equals("")) ) { emRef.setUnitName(annotation.unitName()); } emRef.setPersistenceContextType(annotation.type()); emRef.setSynchronizationType(annotation.synchronization()); // Add each property from annotation to descriptor, unless // it has been overridden within the .xml. Map existingProperties = emRef.getProperties(); for(PersistenceProperty next : annotation.properties()) { if( !existingProperties.containsKey(next.name()) ) { emRef.addProperty(next.name(), next.value()); } } }
protected PersistenceContextReferenceMetaData createPC(E element, PersistenceContext annotation) { PersistenceContextReferenceMetaData ref = new PersistenceContextReferenceMetaData(); String name = annotation.name(); if(name.length() == 0) name = ProcessorUtils.getName(element); ref.setPersistenceContextRefName(name); if(annotation.unitName().length() > 0) ref.setPersistenceUnitName(annotation.unitName()); PersistenceContextType type = annotation.type(); ref.setPersistenceContextType(type); PersistenceProperty[] properties = annotation.properties(); if(properties.length > 0 ) { PropertiesMetaData refProperties = new PropertiesMetaData(); for(PersistenceProperty p : properties) { PropertyMetaData pmd = new PropertyMetaData(); pmd.setName(p.name()); pmd.setValue(p.value()); refProperties.add(pmd); } ref.setProperties(refProperties); } Set<ResourceInjectionTargetMetaData> injectionTargets = ProcessorUtils.getInjectionTargets(name, element); if(injectionTargets != null) ref.setInjectionTargets(injectionTargets); return ref; }
ref.setPersistenceContextType(type); PersistenceProperty[] properties = annotation.properties(); if(properties.length > 0 )