Skip to content

Commit

Permalink
Perform check that parent entity is domain class before adding it as …
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Feb 25, 2016
1 parent 028bd7c commit 6a1272c
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.grails.orm.hibernate

import grails.core.GrailsDomainClass
import grails.persistence.Entity

import static junit.framework.Assert.*
import org.junit.Test
Expand Down Expand Up @@ -60,6 +61,7 @@ class BidirectionalOneToManyAndCircularOneToManyTests extends AbstractGrailsHibe
}
}

@Entity
class BidirectionalOneToManyAndCircularOneToManyUser implements java.io.Serializable {
Long id
Long version
Expand All @@ -74,13 +76,15 @@ class BidirectionalOneToManyAndCircularOneToManyUser implements java.io.Serializ
BidirectionalOneToManyAndCircularOneToManyUser manager
}

@Entity
class BidirectionalOneToManyAndCircularOneToManyUploadLog implements Serializable {
Long id
Long version
static belongsTo = BidirectionalOneToManyAndCircularOneToManyUser
BidirectionalOneToManyAndCircularOneToManyUser sender
}

@Entity
class BidirectionalOneToManyAndCircularOneToManyUpload implements Serializable {
Long id
Long version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.grails.orm.hibernate

import grails.persistence.Entity
import org.junit.Test

import static junit.framework.Assert.*
Expand All @@ -26,12 +27,9 @@ class CircularOneToManyTests extends AbstractGrailsHibernateTests {
}
}

@Entity
class CircularOneToManyTask {
Long id
Long version
Set tasks
CircularOneToManyTask task
static belongsTo = CircularOneToManyTask
static hasMany = [tasks:CircularOneToManyTask]
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.grails.orm.hibernate

import grails.persistence.Entity

import static junit.framework.Assert.*
import org.junit.Test
Expand Down Expand Up @@ -28,13 +29,15 @@ class ListDomainTests extends AbstractGrailsHibernateTests{
}
}

@Entity
class ListDomainBook {
Long id
Long version
List authors
static hasMany = [authors:ListDomainAuthor]
}

@Entity
class ListDomainAuthor {
Long id
Long version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ManyToManyAndOneToOneTests extends AbstractGrailsHibernateTests {
}
}

@grails.persistence.Entity
class ManyToManyAndOneToOneBook {
Long version
Long id
Expand All @@ -47,6 +48,7 @@ class ManyToManyAndOneToOneBook {
String title
}

@grails.persistence.Entity
class ManyToManyAndOneToOneAuthor {
Long version
Long id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.grails.orm.hibernate

import grails.persistence.Entity

import static junit.framework.Assert.*
import org.junit.Test

Expand Down Expand Up @@ -33,14 +35,14 @@ class MapDomainTests extends AbstractGrailsHibernateTests{
}
}

@Entity
class MapDomainBook {
Long id
Long version
Map simpleAuthors
Map authors
static hasMany = [authors:MapDomainAuthor]
}

@Entity
class MapDomainAuthor {
Long id
Long version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class OneToOneSelfReferencedViaInheritanceTests extends AbstractGrailsHibernateT
}
}

@grails.persistence.Entity
class OneToOneSelfReferencedViaInheritanceContent implements Serializable {
Long id
Long version
Expand All @@ -42,11 +43,13 @@ class OneToOneSelfReferencedViaInheritanceContent implements Serializable {
}
}

@grails.persistence.Entity
class OneToOneSelfReferencedViaInheritanceVersion extends OneToOneSelfReferencedViaInheritanceContent {
Integer number
OneToOneSelfReferencedViaInheritanceContent current
}

@grails.persistence.Entity
class OneToOneSelfReferencedViaInheritanceWikiPage extends OneToOneSelfReferencedViaInheritanceContent {
Set versions
static hasMany = [versions:OneToOneSelfReferencedViaInheritanceVersion]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.grails.orm.hibernate

import grails.persistence.Entity

import static junit.framework.Assert.*
import org.junit.Test

Expand All @@ -20,13 +22,15 @@ class SimpleBelongsToMappingTests extends AbstractGrailsHibernateTests {
}
}

@Entity
class SimpleBelongsToMappingBook {
Long id
Long version
SimpleBelongsToMappingAuthor author
static belongsTo = [author:SimpleBelongsToMappingAuthor]
}

@Entity
class SimpleBelongsToMappingAuthor {
Long id
Long version
Expand Down
Loading

0 comments on commit 6a1272c

Please sign in to comment.