Browse Source
HibernateEntityManagerFactoryIntegrationTests in the spring-orm module has been disabled for quite some time due to a dependency on the AnnotationBeanConfigurerAspect from the spring-aspects module. Since spring-aspects depends on spring-orm, a cyclical dependency would result if this code were re-enabled "as is". This commit removes the dependency on AnnotationBeanConfigurerAspect in HibernateEntityManagerFactoryIntegrationTests by deleting all test code and configuration related to @Configurable. In addition, this commit also deletes all SessionFactory-specific test code in HibernateEntityManagerFactoryIntegrationTests, allowing the test class to focus on Hibernate as a JPA provider. Issue: SPR-11922pull/578/merge
8 changed files with 29 additions and 196 deletions
@ -1,104 +0,0 @@
@@ -1,104 +0,0 @@
|
||||
/* |
||||
* Copyright 2002-2013 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.orm.jpa.domain; |
||||
|
||||
import javax.persistence.Basic; |
||||
import javax.persistence.CascadeType; |
||||
import javax.persistence.Entity; |
||||
import javax.persistence.EntityManager; |
||||
import javax.persistence.FetchType; |
||||
import javax.persistence.GeneratedValue; |
||||
import javax.persistence.GenerationType; |
||||
import javax.persistence.Id; |
||||
import javax.persistence.JoinColumn; |
||||
import javax.persistence.OneToOne; |
||||
import javax.persistence.PersistenceContext; |
||||
|
||||
import org.springframework.tests.sample.beans.TestBean; |
||||
import org.springframework.beans.factory.annotation.Configurable; |
||||
|
||||
/** |
||||
* @author Juergen Hoeller |
||||
*/ |
||||
@Entity |
||||
@Configurable |
||||
public class ContextualPerson { |
||||
|
||||
@Id |
||||
@GeneratedValue(strategy=GenerationType.AUTO) |
||||
private Integer id; |
||||
|
||||
private transient TestBean testBean; |
||||
|
||||
// Lazy relationship to force use of instrumentation in JPA implementation.
|
||||
@OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST) |
||||
@JoinColumn(name="DRIVERS_LICENSE_ID") |
||||
private DriversLicense driversLicense; |
||||
|
||||
private String first_name; |
||||
|
||||
@Basic(fetch=FetchType.LAZY) |
||||
private String last_name; |
||||
|
||||
@PersistenceContext |
||||
public transient EntityManager entityManager; |
||||
|
||||
|
||||
public Integer getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setTestBean(TestBean testBean) { |
||||
this.testBean = testBean; |
||||
} |
||||
|
||||
public TestBean getTestBean() { |
||||
return testBean; |
||||
} |
||||
|
||||
public void setFirstName(String firstName) { |
||||
this.first_name = firstName; |
||||
} |
||||
|
||||
public String getFirstName() { |
||||
return this.first_name; |
||||
} |
||||
|
||||
public void setLastName(String lastName) { |
||||
this.last_name = lastName; |
||||
} |
||||
|
||||
public String getLastName() { |
||||
return this.last_name; |
||||
} |
||||
|
||||
public void setDriversLicense(DriversLicense driversLicense) { |
||||
this.driversLicense = driversLicense; |
||||
} |
||||
|
||||
public DriversLicense getDriversLicense() { |
||||
return this.driversLicense; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String toString() { |
||||
return getClass().getName() + ":(" + hashCode() + ") id=" + id + |
||||
"; firstName=" + first_name + "; lastName=" + last_name + "; testBean=" + testBean; |
||||
} |
||||
|
||||
} |
@ -1,13 +1,11 @@
@@ -1,13 +1,11 @@
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" |
||||
version="1.0"> |
||||
|
||||
|
||||
<persistence-unit name="Person" transaction-type="RESOURCE_LOCAL"> |
||||
<class>org.springframework.orm.jpa.domain.ContextualPerson</class> |
||||
<class>org.springframework.orm.jpa.domain.DriversLicense</class> |
||||
<class>org.springframework.orm.jpa.domain.Person</class> |
||||
<exclude-unlisted-classes/> |
||||
<exclude-unlisted-classes /> |
||||
</persistence-unit> |
||||
|
||||
</persistence> |
||||
|
@ -1,17 +1,16 @@
@@ -1,17 +1,16 @@
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" |
||||
version="1.0"> |
||||
|
||||
|
||||
<persistence-unit name="Drivers" transaction-type="RESOURCE_LOCAL"> |
||||
<class>org.springframework.orm.jpa.domain.Person</class> |
||||
<class>org.springframework.orm.jpa.domain.DriversLicense</class> |
||||
<exclude-unlisted-classes/> |
||||
<exclude-unlisted-classes /> |
||||
</persistence-unit> |
||||
|
||||
<persistence-unit name="Test" transaction-type="RESOURCE_LOCAL"> |
||||
<class>org.springframework.tests.sample.beans.TestBean</class> |
||||
<exclude-unlisted-classes/> |
||||
<exclude-unlisted-classes /> |
||||
</persistence-unit> |
||||
|
||||
</persistence> |
||||
|
@ -1,12 +1,11 @@
@@ -1,12 +1,11 @@
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" |
||||
version="1.0"> |
||||
|
||||
|
||||
<persistence-unit name="Person" transaction-type="RESOURCE_LOCAL"> |
||||
<class>org.springframework.orm.jpa.domain.Person</class> |
||||
<class>org.springframework.orm.jpa.domain.DriversLicense</class> |
||||
<exclude-unlisted-classes/> |
||||
<exclude-unlisted-classes /> |
||||
</persistence-unit> |
||||
|
||||
</persistence> |
||||
|
@ -1,41 +1,30 @@
@@ -1,41 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<beans xmlns="http://www.springframework.org/schema/beans" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns:context="http://www.springframework.org/schema/context" |
||||
xsi:schemaLocation=" |
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd |
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> |
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd |
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> |
||||
|
||||
<context:load-time-weaver aspectj-weaving="on"/> |
||||
<context:load-time-weaver aspectj-weaving="on" /> |
||||
|
||||
<context:annotation-config/> |
||||
<context:annotation-config /> |
||||
|
||||
<context:spring-configured/> |
||||
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" |
||||
depends-on="org.springframework.context.config.internalBeanConfigurerAspect"> |
||||
<property name="persistenceXmlLocation" value="org/springframework/orm/jpa/domain/persistence-context.xml"/> |
||||
<property name="dataSource" ref="dataSource"/> |
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> |
||||
<property name="persistenceXmlLocation" value="org/springframework/orm/jpa/domain/persistence-context.xml" /> |
||||
<property name="dataSource" ref="dataSource" /> |
||||
<property name="jpaVendorAdapter"> |
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> |
||||
<property name="database" value="HSQL"/> |
||||
<property name="showSql" value="true"/> |
||||
<property name="generateDdl" value="true"/> |
||||
<property name="database" value="HSQL" /> |
||||
<property name="showSql" value="true" /> |
||||
<property name="generateDdl" value="true" /> |
||||
</bean> |
||||
</property> |
||||
<property name="jpaPropertyMap"> |
||||
<props> |
||||
<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop> |
||||
<!-- |
||||
<prop key="hibernate.ejb.use_class_enhancer">true</prop> |
||||
--> |
||||
<!-- <prop key="hibernate.ejb.use_class_enhancer">true</prop> --> |
||||
</props> |
||||
</property> |
||||
</bean> |
||||
|
||||
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> |
||||
<property name="dataSource" ref="dataSource"/> |
||||
<property name="packagesToScan" value="org.springframework.orm.jpa.domain"/> |
||||
</bean> |
||||
|
||||
</beans> |
||||
|
Loading…
Reference in new issue