This will generate a query returning all persons with the specified first name.
Entity Person {
String firstName
String lastName
Date birthDate
PersonRepository {
findBy(String firstName);
}
}
More advanced conditions can also be specified
PersonRepository {
findBornBefore(Date bd) condition="birthDate < :bd" orderBy="firstName";
findByName(String name) condition="lastName i= :name or firstName i= :name";
}
Sculptor generates findByCondition expressions and will report at generation time if there are any errors in the queries.
Another nice addition is the generated builder classes that provides a fluent interface to build domain objects in a manner that can be easier to work with and read.
Book book = book()
.createdBy("me")
.createdDate(now)
.title("Ender's Game")
.isbn("Some-ISBN")
.addMediaCharacter(mediaCharacter()
.name("Ender")
.build())
.build();
Read more about the release.