Tabnine Logo
PersistenceAnnotationBeanPostProcessor.postProcessProperties
Code IndexAdd Tabnine to your IDE (free)

How to use
postProcessProperties
method
in
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor

Best Java code snippets using org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessProperties (Showing top 11 results out of 315)

origin: spring-projects/spring-framework

@Deprecated
@Override
public PropertyValues postProcessPropertyValues(
    PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) {
  return postProcessProperties(pvs, bean, beanName);
}
origin: org.springframework/spring-orm

@Deprecated
@Override
public PropertyValues postProcessPropertyValues(
    PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) {
  return postProcessProperties(pvs, bean, beanName);
}
origin: spring-projects/spring-framework

@Test
public void testPropertiesPassedIn() {
  Properties props = new Properties();
  props.put("foo", "bar");
  EntityManager mockEm = mock(EntityManager.class);
  given(mockEmf.createEntityManager(props)).willReturn(mockEm);
  PersistenceAnnotationBeanPostProcessor pabpp = new MockPersistenceAnnotationBeanPostProcessor();
  DefaultPrivatePersistenceContextFieldExtendedWithProps dppcf =
      new DefaultPrivatePersistenceContextFieldExtendedWithProps();
  pabpp.postProcessProperties(null, dppcf, "bean");
  assertNotNull(dppcf.em);
}
origin: spring-projects/spring-framework

@Test
public void testFieldOfWrongTypeAnnotatedWithPersistenceUnit() {
  PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor();
  try {
    pabpp.postProcessProperties(null, new FieldOfWrongTypeAnnotatedWithPersistenceUnit(), "bean");
    fail("Can't inject this field");
  }
  catch (IllegalStateException ex) {
    // Ok
  }
}
origin: spring-projects/spring-framework

@Test
public void testSetterOfWrongTypeAnnotatedWithPersistenceUnit() {
  PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor();
  try {
    pabpp.postProcessProperties(null, new SetterOfWrongTypeAnnotatedWithPersistenceUnit(), "bean");
    fail("Can't inject this setter");
  }
  catch (IllegalStateException ex) {
    // Ok
  }
}
origin: spring-projects/spring-framework

@Test
public void testSetterWithNoArgs() {
  PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor();
  try {
    pabpp.postProcessProperties(null, new SetterWithNoArgs(), "bean");
    fail("Can't inject this setter");
  }
  catch (IllegalStateException ex) {
    // Ok
  }
}
origin: spring-projects/spring-framework

@Test
public void testNoPropertiesPassedIn() {
  EntityManager mockEm = mock(EntityManager.class);
  given(mockEmf.createEntityManager()).willReturn(mockEm);
  PersistenceAnnotationBeanPostProcessor pabpp = new MockPersistenceAnnotationBeanPostProcessor();
  DefaultPrivatePersistenceContextFieldExtended dppcf = new DefaultPrivatePersistenceContextFieldExtended();
  pabpp.postProcessProperties(null, dppcf, "bean");
  assertNotNull(dppcf.em);
}
origin: spring-projects/spring-framework

@Test
public void testPropertiesForTransactionalEntityManager() {
  Properties props = new Properties();
  props.put("foo", "bar");
  EntityManager em = mock(EntityManager.class);
  given(mockEmf.createEntityManager(props)).willReturn(em);
  given(em.getDelegate()).willReturn(new Object());
  given(em.isOpen()).willReturn(true);
  PersistenceAnnotationBeanPostProcessor pabpp = new MockPersistenceAnnotationBeanPostProcessor();
  DefaultPrivatePersistenceContextFieldWithProperties transactionalField =
      new DefaultPrivatePersistenceContextFieldWithProperties();
  pabpp.postProcessProperties(null, transactionalField, "bean");
  assertNotNull(transactionalField.em);
  assertNotNull(transactionalField.em.getDelegate());
  verify(em).close();
}
origin: spring-projects/spring-framework

@Test
public void testPropertiesForSharedEntityManager2() {
  Properties props = new Properties();
  props.put("foo", "bar");
  EntityManager em = mock(EntityManager.class);
  // only one call made  - the first EM definition wins (in this case the one w/o the properties)
  given(mockEmf.createEntityManager()).willReturn(em);
  given(em.getDelegate()).willReturn(new Object(), 2);
  given(em.isOpen()).willReturn(true);
  PersistenceAnnotationBeanPostProcessor pabpp = new MockPersistenceAnnotationBeanPostProcessor();
  DefaultPrivatePersistenceContextFieldWithProperties transactionalFieldWithProperties =
      new DefaultPrivatePersistenceContextFieldWithProperties();
  DefaultPrivatePersistenceContextField transactionalField = new DefaultPrivatePersistenceContextField();
  pabpp.postProcessProperties(null, transactionalFieldWithProperties, "bean1");
  pabpp.postProcessProperties(null, transactionalField, "bean2");
  assertNotNull(transactionalFieldWithProperties.em);
  assertNotNull(transactionalField.em);
  // the EM w/o properties will be created
  assertNotNull(transactionalField.em.getDelegate());
  // bind em to the thread now since it's created
  try {
    TransactionSynchronizationManager.bindResource(mockEmf, new EntityManagerHolder(em));
    assertNotNull(transactionalFieldWithProperties.em.getDelegate());
    verify(em).close();
  }
  finally {
    TransactionSynchronizationManager.unbindResource(mockEmf);
  }
}
origin: spring-projects/spring-framework

@Before
public void setup() {
  factory = mock(EntityManagerFactory.class);
  manager = mock(EntityManager.class);
  tx = mock(EntityTransaction.class);
  JpaTransactionManager tm = new JpaTransactionManager(factory);
  tt = new TransactionTemplate(tm);
  given(factory.createEntityManager()).willReturn(manager);
  given(manager.getTransaction()).willReturn(tx);
  given(manager.isOpen()).willReturn(true);
  bean = new EntityManagerHoldingBean();
  @SuppressWarnings("serial")
  PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor() {
    @Override
    protected EntityManagerFactory findEntityManagerFactory(@Nullable String unitName, String requestingBeanName) {
      return factory;
    }
  };
  pabpp.postProcessProperties(null, bean, "bean");
  assertTrue(TransactionSynchronizationManager.getResourceMap().isEmpty());
  assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
}
origin: spring-projects/spring-framework

DefaultPrivatePersistenceContextField transactionalField = new DefaultPrivatePersistenceContextField();
pabpp.postProcessProperties(null, transactionalFieldWithProperties, "bean1");
pabpp.postProcessProperties(null, transactionalField, "bean2");
org.springframework.orm.jpa.supportPersistenceAnnotationBeanPostProcessorpostProcessProperties

Popular methods of PersistenceAnnotationBeanPostProcessor

  • <init>
  • buildPersistenceMetadata
  • findDefaultEntityManagerFactory
    Find a single default EntityManagerFactory in the Spring application context.
  • findEntityManagerFactory
    Find an EntityManagerFactory with the given name in the current Spring application context, falling
  • findNamedEntityManagerFactory
    Find an EntityManagerFactory with the given name in the current Spring application context.
  • findPersistenceMetadata
  • getPersistenceContext
    Return a specified persistence context for the given unit name, as defined through the "persistenceC
  • getPersistenceUnit
    Return a specified persistence unit for the given unit name, as defined through the "persistenceUnit
  • lookup
    Perform a JNDI lookup for the given resource by name.Called for EntityManagerFactory and EntityManag
  • postProcessMergedBeanDefinition
  • setDefaultPersistenceUnitName
    Specify the default persistence unit name, to be used in case of no unit name specified in an @Persi
  • setExtendedPersistenceContexts
    Specify the extended persistence contexts for EntityManager lookups, as a Map from persistence unit
  • setDefaultPersistenceUnitName,
  • setExtendedPersistenceContexts,
  • setJndiTemplate,
  • setPersistenceContexts,
  • setPersistenceUnits

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • Kernel (java.awt.image)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now