petclinic-memoizeit
Changes
src/main/resources/META-INF/orm.xml 14(+7 -7)
Details
src/main/resources/META-INF/orm.xml 14(+7 -7)
diff --git a/src/main/resources/META-INF/orm.xml b/src/main/resources/META-INF/orm.xml
index d7c8f70..7ea243e 100644
--- a/src/main/resources/META-INF/orm.xml
+++ b/src/main/resources/META-INF/orm.xml
@@ -42,10 +42,10 @@
</mapped-superclass>
<entity class="Vet">
- <table name="VETS"/>
+ <table name="vets"/>
<attributes>
<many-to-many name="specialtiesInternal" target-entity="Specialty" fetch="EAGER">
- <join-table name="VET_SPECIALTIES">
+ <join-table name="vet_specialties">
<join-column name="VET_ID"/>
<inverse-join-column name="SPECIALTY_ID"/>
</join-table>
@@ -56,11 +56,11 @@
</entity>
<entity class="Specialty">
- <table name="SPECIALTIES"/>
+ <table name="specialties"/>
</entity>
<entity class="Owner">
- <table name="OWNERS"/>
+ <table name="owners"/>
<attributes>
<basic name="address"/>
<basic name="city"/>
@@ -75,7 +75,7 @@
</entity>
<entity class="Pet">
- <table name="PETS"/>
+ <table name="pets"/>
<attributes>
<basic name="birthDate">
<column name="BIRTH_DATE"/>
@@ -101,11 +101,11 @@
</entity>
<entity class="PetType">
- <table name="TYPES"/>
+ <table name="types"/>
</entity>
<entity class="Visit">
- <table name="VISITS"/>
+ <table name="visits"/>
<attributes>
<basic name="date">
<column name="VISIT_DATE"/>
diff --git a/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java b/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
index a698691..63010dc 100644
--- a/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/AbstractClinicTests.java
@@ -92,7 +92,7 @@ public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4Spr
Collection<Vet> vets = this.clinic.getVets();
// Use the inherited countRowsInTable() convenience method (from
// AbstractTransactionalJUnit4SpringContextTests) to verify the results.
- assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("VETS"), vets.size());
+ assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("vets"), vets.size());
Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
assertEquals("Leary", v1.getLastName());
assertEquals(1, v1.getNrOfSpecialties());
@@ -107,7 +107,7 @@ public abstract class AbstractClinicTests extends AbstractTransactionalJUnit4Spr
@Test
public void getPetTypes() {
Collection<PetType> petTypes = this.clinic.getPetTypes();
- assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("TYPES"),
+ assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("types"),
petTypes.size());
PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1);
assertEquals("cat", t1.getName());
diff --git a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
index d8adc91..335297d 100644
--- a/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/jpa/AbstractJpaClinicTests.java
@@ -83,7 +83,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
// Use the inherited countRowsInTable() convenience method (from
// AbstractTransactionalDataSourceSpringContextTests) to verify the
// results.
- assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("VETS"), vets.size());
+ assertEquals("JDBC query must show the same number of vets", super.countRowsInTable("vets"), vets.size());
Vet v1 = EntityUtils.getById(vets, Vet.class, 2);
assertEquals("Leary", v1.getLastName());
assertEquals(1, v1.getNrOfSpecialties());
@@ -97,7 +97,7 @@ public abstract class AbstractJpaClinicTests extends AbstractJpaTests {
public void testGetPetTypes() {
Collection<PetType> petTypes = this.clinic.getPetTypes();
- assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("TYPES"),
+ assertEquals("JDBC query must show the same number of pet types", super.countRowsInTable("types"),
petTypes.size());
PetType t1 = EntityUtils.getById(petTypes, PetType.class, 1);
assertEquals("cat", t1.getName());
diff --git a/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml b/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml
index a0bc4bd..d048d8a 100644
--- a/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml
+++ b/src/test/resources/org/springframework/samples/petclinic/AbstractClinicTests-context.xml
@@ -16,9 +16,12 @@
<tx:annotation-driven/>
- <jdbc:embedded-database id="dataSource">
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
+ p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
+ p:username="${jdbc.username}" p:password="${jdbc.password}"/>
+
+ <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL">
<jdbc:script location="${jdbc.initLocation}"/>
<jdbc:script location="${jdbc.dataLocation}"/>
- </jdbc:embedded-database>
-
+ </jdbc:initialize-database>
</beans>
diff --git a/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml b/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml
index f5fbe56..3202f94 100644
--- a/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml
+++ b/src/test/resources/org/springframework/samples/petclinic/jpa/applicationContext-jpaCommon.xml
@@ -14,11 +14,16 @@
<tx:annotation-driven />
- <jdbc:embedded-database id="dataSource">
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
+ p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
+ p:username="${jdbc.username}" p:password="${jdbc.password}"/>
+
+ <jdbc:initialize-database data-source="dataSource">
<jdbc:script location="${jdbc.initLocation}"/>
<jdbc:script location="${jdbc.dataLocation}"/>
- </jdbc:embedded-database>
-
+ </jdbc:initialize-database>
+
+
<!-- Note: the specific "jpaAdapter" bean sits in adapter context file -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource" p:jpaVendorAdapter-ref="jpaAdapter">
@@ -30,5 +35,4 @@
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory" />
-
</beans>