Hi All, I created a new DomainClass that looks lik...
# questions
u
Hi All, I created a new DomainClass that looks like this,
Copy code
class Node {
	UUID id
    String anotherId

    static belongsTo = [Parent: parent]
}
and when I do
findByAnotherId(String anotherId)
it fails with
org.hibernate.QueryException: could not resolve property: name of: com.example.cs.Node
But when I add another field to the domain with
String Name
everything seems to work fine. Why is that so? Is this expected behaviour that all domain classes must have a name?
m
The domain is as simple as you have exposed? Which Grails version are you using?
u
Yes its as simple as I have exposed(but without
UUID id
) it but extends another domain called
Copy code
@GrailsCompileStatic
class SubResource {
    UUID id = UUID.randomUUID()
    Date dateCreated
    Date lastUpdated

    static constraints = {
        dateCreated nullable: true
        lastUpdated nullable: true
    }
}
u
and I am using the version 7.0.0-M3
u
so the domain accurately looks like
Copy code
class Node extends SubResource{
    String anotherId

    static belongsTo = [Parent: parent]
}
m
Ah ok, sorry, I supposed that maybe you had something like a String toString() { this.name } in domain or parent domain...
u
Got the issue. We have in our project a mapping which has
sort by name
which was causing this issue. Thanks a lot @muser for your attention to this problem
partygrails 1