org.springframework.orm.jpa.DefaultJpaDialect Java Examples
The following examples show how to use
org.springframework.orm.jpa.DefaultJpaDialect.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersistenceInjectionTests.java From spring-analysis-note with MIT License | 6 votes |
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testPublicExtendedPersistenceContextSetterWithEntityManagerInfoAndSerialization() throws Exception { EntityManager mockEm = mock(EntityManager.class, withSettings().serializable()); given(mockEm.isOpen()).willReturn(true); EntityManagerFactoryWithInfo mockEmf = mock(EntityManagerFactoryWithInfo.class); given(mockEmf.getNativeEntityManagerFactory()).willReturn(mockEmf); given(mockEmf.getJpaDialect()).willReturn(new DefaultJpaDialect()); given(mockEmf.getEntityManagerInterface()).willReturn((Class)EntityManager.class); given(mockEmf.getBeanClassLoader()).willReturn(getClass().getClassLoader()); given(mockEmf.createEntityManager()).willReturn(mockEm); GenericApplicationContext gac = new GenericApplicationContext(); gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf); gac.registerBeanDefinition("annotationProcessor", new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class)); gac.registerBeanDefinition(DefaultPublicPersistenceContextSetter.class.getName(), new RootBeanDefinition(DefaultPublicPersistenceContextSetter.class)); gac.refresh(); DefaultPublicPersistenceContextSetter bean = (DefaultPublicPersistenceContextSetter) gac.getBean( DefaultPublicPersistenceContextSetter.class.getName()); assertNotNull(bean.em); assertNotNull(SerializationTestUtils.serializeAndDeserialize(bean.em)); }
Example #2
Source File: PersistenceInjectionTests.java From java-technology-stack with MIT License | 6 votes |
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testPublicExtendedPersistenceContextSetterWithEntityManagerInfoAndSerialization() throws Exception { EntityManager mockEm = mock(EntityManager.class, withSettings().serializable()); given(mockEm.isOpen()).willReturn(true); EntityManagerFactoryWithInfo mockEmf = mock(EntityManagerFactoryWithInfo.class); given(mockEmf.getNativeEntityManagerFactory()).willReturn(mockEmf); given(mockEmf.getJpaDialect()).willReturn(new DefaultJpaDialect()); given(mockEmf.getEntityManagerInterface()).willReturn((Class)EntityManager.class); given(mockEmf.getBeanClassLoader()).willReturn(getClass().getClassLoader()); given(mockEmf.createEntityManager()).willReturn(mockEm); GenericApplicationContext gac = new GenericApplicationContext(); gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf); gac.registerBeanDefinition("annotationProcessor", new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class)); gac.registerBeanDefinition(DefaultPublicPersistenceContextSetter.class.getName(), new RootBeanDefinition(DefaultPublicPersistenceContextSetter.class)); gac.refresh(); DefaultPublicPersistenceContextSetter bean = (DefaultPublicPersistenceContextSetter) gac.getBean( DefaultPublicPersistenceContextSetter.class.getName()); assertNotNull(bean.em); assertNotNull(SerializationTestUtils.serializeAndDeserialize(bean.em)); }
Example #3
Source File: PersistenceInjectionTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testPublicExtendedPersistenceContextSetterWithEntityManagerInfoAndSerialization() throws Exception { EntityManager mockEm = mock(EntityManager.class, withSettings().serializable()); given(mockEm.isOpen()).willReturn(true); EntityManagerFactoryWithInfo mockEmf = mock(EntityManagerFactoryWithInfo.class); given(mockEmf.getNativeEntityManagerFactory()).willReturn(mockEmf); given(mockEmf.getJpaDialect()).willReturn(new DefaultJpaDialect()); given(mockEmf.getEntityManagerInterface()).willReturn((Class)EntityManager.class); given(mockEmf.getBeanClassLoader()).willReturn(getClass().getClassLoader()); given(mockEmf.createEntityManager()).willReturn(mockEm); GenericApplicationContext gac = new GenericApplicationContext(); gac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", mockEmf); gac.registerBeanDefinition("annotationProcessor", new RootBeanDefinition(PersistenceAnnotationBeanPostProcessor.class)); gac.registerBeanDefinition(DefaultPublicPersistenceContextSetter.class.getName(), new RootBeanDefinition(DefaultPublicPersistenceContextSetter.class)); gac.refresh(); DefaultPublicPersistenceContextSetter bean = (DefaultPublicPersistenceContextSetter) gac.getBean( DefaultPublicPersistenceContextSetter.class.getName()); assertNotNull(bean.em); assertNotNull(SerializationTestUtils.serializeAndDeserialize(bean.em)); }