CriteriaQuery criteriaQuery = builder.createQuery(Hobby.class);
Root hobbyRoot = criteriaQuery.from(Hobby.class);
criteriaQuery.orderBy(builder.asc(hobbyRoot.type());
List hobbies = entityManager.createQuery(criteriaQuery).getResultList();
${...} is the property placeholder syntax. It can only be used to dereference properties.
#{...} is SpEL syntax, which is far more capable and complex. It can also handle property placeholders, and a lot more besides.
Both are valid, and neither is deprecated.
Eu usei no grails para poder chamar os "mappings" da classe pai:
def pm = EntityBase.mapping.clone()
pm.delegate = delegate
pm.call()
def pm = BaseDomainClass.mapping.clone() pm.delegate = delegate pm.call()
Sellable class into the src/groovy package. If the Sellable class is in the src/groovy directory it will no longer be regarded as persistent.
grails.plugin.springsecurity. onAuthenticationSwitchUserEvent = { e, appCtx ->
// handle AuthenticationSwitchUserEvent
}
def displayName = user.name ? user.name : "Anonymous"
//traditional ternary operator usage
def displayName = user.name ?: "Anonymous"
// more compact Elvis operator - does same as above