/** * Instantiates a new entity manager impl. * * @param factory * the factory * @param properties * the properties */ EntityManagerImpl(final EntityManagerFactory factory, final Map properties, PersistenceUnitTransactionType transactionType, final PersistenceContextType persistenceContextType) { this(factory, transactionType, persistenceContextType); this.properties = properties; getPersistenceDelegator().populateClientProperties(this.properties); }
/** * Set an entity manager property or hint. If a vendor-specific property or * hint is not recognized, it is silently ignored. * * @param propertyName * name of property or hint * @param value * @throws IllegalArgumentException * if the second argument is not valid for the implementation * @see javax.persistence.EntityManager#setProperty(java.lang.String, * java.lang.Object) */ @Override public void setProperty(String paramString, Object paramObject) { checkClosed(); if (getProperties() == null) { this.properties = new HashMap<String, Object>(); } this.properties.put(paramString, paramObject); getPersistenceDelegator().populateClientProperties(this.properties); }
getPersistenceDelegator().populateClientProperties(properties); getPersistenceDelegator().populateClientProperties(currentProperties);
getPersistenceDelegator().populateClientProperties(properties); T result = find(entityClass, primaryKey); getPersistenceDelegator().populateClientProperties(currentProperties); return result;
@Test public void testPopulateClientProperties() { Map props = new HashMap(); props.put("core.test.property", "core-test-property-value"); PersistenceDelegator pd = ((EntityManagerImpl) em).getPersistenceDelegator(); pd.populateClientProperties(props); Map map = em.getProperties(); Map<String, Client> clients = (Map<String, Client>) em.getDelegate(); CoreTestClient client = (CoreTestClient) clients.get("kunderatest"); Assert.assertEquals("core-test-property-value", client.getCoreTestProperty()); }