This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch merge-hibernate6
in repository https://gitbox.apache.org/repos/asf/grails-core.git
The following commit(s) were added to refs/heads/merge-hibernate6 by this push:
new e9ecea2255 Removed mapping problem from Test
e9ecea2255 is described below
commit e9ecea2255df39d327b504abc7d57da1c81a846b
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Tue Jun 17 21:56:09 2025 -0500
Removed mapping problem from Test
---
.../connections/PartitionedMultiTenancySpec.groovy | 2 +-
.../grails/data/testing/tck/domains/Person.groovy | 2 +
.../data/testing/tck/domains/SimpleCountry.groovy | 12 ++++
.../data/testing/tck/tests/SizeQuerySpec.groovy | 72 +++++++++++-----------
4 files changed, 51 insertions(+), 37 deletions(-)
diff --git
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/PartitionedMultiTenancySpec.groovy
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/PartitionedMultiTenancySpec.groovy
index 7d17325eb5..1a4dc87dfa 100644
---
a/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/PartitionedMultiTenancySpec.groovy
+++
b/grails-data-hibernate6/core/src/test/groovy/org/grails/orm/hibernate/connections/PartitionedMultiTenancySpec.groovy
@@ -42,7 +42,7 @@ class PartitionedMultiTenancySpec extends
HibernateGormDatastoreSpec {
def setupSpec() {
manager.domainClasses.addAll([MultiTenantAuthor, MultiTenantBook,
MultiTenantPublisher])
manager.grailsConfig = [
- 'dataSource.url' :
"jdbc:tc:postgresql:latest:///dev_db",
+ 'dataSource.url' :
"jdbc:h2:mem:grailsDB;LOCK_TIMEOUT=10000",
'dataSource.dbCreate' : 'create-drop',
'dataSource.formatSql' : 'true',
'dataSource.logSql' : 'true',
diff --git
a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/Person.groovy
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/Person.groovy
index 7879560c53..f14720c1ed 100644
---
a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/Person.groovy
+++
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/Person.groovy
@@ -43,6 +43,7 @@ class Person implements Serializable, Comparable<Person>,
AsyncEntity<Person> {
Integer age = 0
Set<Pet> pets = [] as Set
static hasMany = [pets: Pet]
+ SimpleCountry country
Face face
boolean myBooleanProperty
@@ -73,6 +74,7 @@ class Person implements Serializable, Comparable<Person>,
AsyncEntity<Person> {
static constraints = {
face nullable: true
+ country nullable: true
}
@Override
diff --git
a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/SimpleCountry.groovy
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/SimpleCountry.groovy
new file mode 100644
index 0000000000..804fd3d873
--- /dev/null
+++
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/domains/SimpleCountry.groovy
@@ -0,0 +1,12 @@
+package org.apache.grails.data.testing.tck.domains
+
+import grails.persistence.Entity
+
+@Entity
+class SimpleCountry {
+ Integer id
+ String name
+
+ static hasMany = [residents: Person]
+ Set residents
+}
\ No newline at end of file
diff --git
a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/SizeQuerySpec.groovy
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/SizeQuerySpec.groovy
index 7902e04498..5eaf8eb5af 100644
---
a/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/SizeQuerySpec.groovy
+++
b/grails-datamapping-tck/src/main/groovy/org/apache/grails/data/testing/tck/tests/SizeQuerySpec.groovy
@@ -18,7 +18,7 @@
*/
package org.apache.grails.data.testing.tck.tests
-import org.apache.grails.data.testing.tck.domains.Country
+import org.apache.grails.data.testing.tck.domains.SimpleCountry
import org.apache.grails.data.testing.tck.domains.Person
import org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
@@ -27,24 +27,24 @@ import
org.apache.grails.data.testing.tck.base.GrailsDataTckSpec
*/
class SizeQuerySpec extends GrailsDataTckSpec {
void setupSpec() {
- manager.domainClasses.addAll([Country, Person])
+ manager.domainClasses.addAll([SimpleCountry, Person])
}
void "Test sizeLe criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
.save(flush: true)
- new Country(name: "Miami")
+ new SimpleCountry(name: "Miami")
.addToResidents(firstName: "Dexter", lastName: "Morgan")
.addToResidents(firstName: "Debra", lastName: "Morgan")
.save(flush: true)
@@ -52,7 +52,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries with 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeLe "residents", 3
order "name"
}
@@ -65,7 +65,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[2].name == 'Springfield'
when: "We query for countries with 2 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeLe "residents", 2
order "name"
}
@@ -77,7 +77,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[1].name == 'Miami'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeLe "residents", 1
}
@@ -88,17 +88,17 @@ class SizeQuerySpec extends GrailsDataTckSpec {
void "Test sizeLt criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
.save(flush: true)
- new Country(name: "Miami")
+ new SimpleCountry(name: "Miami")
.addToResidents(firstName: "Dexter", lastName: "Morgan")
.addToResidents(firstName: "Debra", lastName: "Morgan")
.save(flush: true)
@@ -106,7 +106,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries with 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeLt "residents", 3
order "name"
}
@@ -118,7 +118,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[1].name == 'Miami'
when: "We query for countries with 2 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeLt "residents", 2
}
@@ -128,7 +128,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Dinoville'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeLt "residents", 1
}
@@ -139,17 +139,17 @@ class SizeQuerySpec extends GrailsDataTckSpec {
void "Test sizeGt criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
.save(flush: true)
- new Country(name: "Miami")
+ new SimpleCountry(name: "Miami")
.addToResidents(firstName: "Dexter", lastName: "Morgan")
.addToResidents(firstName: "Debra", lastName: "Morgan")
.save(flush: true)
@@ -157,7 +157,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries with 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeGt "residents", 1
order "name"
}
@@ -169,7 +169,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[1].name == 'Springfield'
when: "We query for countries with 2 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeGt "residents", 2
}
@@ -179,7 +179,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Springfield'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeGt "residents", 5
}
@@ -190,17 +190,17 @@ class SizeQuerySpec extends GrailsDataTckSpec {
void "Test sizeGe criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
.save(flush: true)
- new Country(name: "Miami")
+ new SimpleCountry(name: "Miami")
.addToResidents(firstName: "Dexter", lastName: "Morgan")
.addToResidents(firstName: "Debra", lastName: "Morgan")
.save(flush: true)
@@ -208,7 +208,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries with 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeGe "residents", 1
order "name"
}
@@ -221,7 +221,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[2].name == 'Springfield'
when: "We query for countries with 2 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeGe "residents", 2
order "name"
}
@@ -233,7 +233,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[1].name == 'Springfield'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeGe "residents", 5
}
@@ -244,11 +244,11 @@ class SizeQuerySpec extends GrailsDataTckSpec {
void "Test sizeEq criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
@@ -257,7 +257,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries with 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeEq "residents", 1
}
@@ -267,7 +267,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Dinoville'
when: "We query for countries with 3 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeEq "residents", 3
}
@@ -277,7 +277,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Springfield'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeEq "residents", 2
}
@@ -288,11 +288,11 @@ class SizeQuerySpec extends GrailsDataTckSpec {
void "Test sizeNe criterion"() {
given: "A country with only 1 resident"
Person p = new Person(firstName: "Fred", lastName: "Flinstone")
- Country c = new Country(name: "Dinoville")
+ SimpleCountry c = new SimpleCountry(name: "Dinoville")
.addToResidents(p)
.save(flush: true)
- new Country(name: "Springfield")
+ new SimpleCountry(name: "Springfield")
.addToResidents(firstName: "Homer", lastName: "Simpson")
.addToResidents(firstName: "Bart", lastName: "Simpson")
.addToResidents(firstName: "Marge", lastName: "Simpson")
@@ -301,7 +301,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
manager.session.clear()
when: "We query for countries that don't have 1 resident"
- def results = Country.withCriteria {
+ def results = SimpleCountry.withCriteria {
sizeNe "residents", 1
}
@@ -311,7 +311,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Springfield'
when: "We query for countries who don't have 3 resident"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
sizeNe "residents", 3
}
@@ -321,7 +321,7 @@ class SizeQuerySpec extends GrailsDataTckSpec {
results[0].name == 'Dinoville'
when: "We query for countries with 2 residents"
- results = Country.withCriteria {
+ results = SimpleCountry.withCriteria {
and {
sizeNe "residents", 1
sizeNe "residents", 3