grails

Failed to validate a newly established connection with grails 3.3.5

雨燕双飞 提交于 2020-01-15 12:44:04
问题 I am using grails 3.3.5 and I have configured my application.yml with some properties in my production data source bellow properties: jmxEnabled: true initialSize: 5 maxActive: 50 minIdle: 5 maxIdle: 25 maxWait: 10000 maxAge: 600000 timeBetweenEvictionRunsMillis: 5000 minEvictableIdleTimeMillis: 60000 validationQuery: SELECT 1 validationQueryTimeout: 10 validationInterval: 15000 testOnBorrow: false testWhileIdle: true testOnReturn: false jdbcInterceptors: ConnectionState

Grails + Mongodb + Spock: NullPointerException being thrown when doing embedded field query

耗尽温柔 提交于 2020-01-15 11:34:33
问题 On one service I'm trying to do something like: Organization.withCriteria { eq( "active", true ) eq( "location.region", region) } which is working but when calling the method inside a unit test I get: java.lang.NullPointerException at org.grails.datastore.mapping.keyvalue.mapping.config.KeyValuePersistentEntity.getPropertyByName(KeyValuePersistentEntity.java:75) at grails.gorm.CriteriaBuilder.validatePropertyName(CriteriaBuilder.java:954) at grails.gorm.CriteriaBuilder.eq(CriteriaBuilder.java

Grails + Mongodb + Spock: NullPointerException being thrown when doing embedded field query

谁都会走 提交于 2020-01-15 11:34:05
问题 On one service I'm trying to do something like: Organization.withCriteria { eq( "active", true ) eq( "location.region", region) } which is working but when calling the method inside a unit test I get: java.lang.NullPointerException at org.grails.datastore.mapping.keyvalue.mapping.config.KeyValuePersistentEntity.getPropertyByName(KeyValuePersistentEntity.java:75) at grails.gorm.CriteriaBuilder.validatePropertyName(CriteriaBuilder.java:954) at grails.gorm.CriteriaBuilder.eq(CriteriaBuilder.java

Grails many-to-many - find all objects that do not contain specific object

寵の児 提交于 2020-01-15 11:27:09
问题 I have following domain model: class Product { static hasMany = [ certificates : Certificate ] } class Certificate { static hasMany = [ products : Product ] static belongsTo = [ Product ] } How can I find all products that do not contain specific certificate? Preferably with criteria query. 回答1: Using the approach that Burt suggested here You can write your query like this: def p = new Product(message:"A") p.addToCertificates (new Certificate(message:"1").save(flush:true) ) p

Error 310: Staging failed deploying - Grails app in Cloud Foundry

允我心安 提交于 2020-01-15 10:22:50
问题 I'm trying to deploy my grails app to Cloud Foundry and I'm getting the eror below. I'm wondering if my mysql datasource is correctly configured in DataSource.groovy and this could be causing the issue or I'm missing something else. ====> /logs/staging.log <==== Uploading Application: Checking for available resources: OK Processing resources: OK Packing application: OK Uploading (116K): OK Push Status: OK Staging Application: ..Error 310: Staging failed: 'Staging plugin failed staging

Grails Import Plugin Fails in Grails (rest plugin: compile “:rest-client-builder:2.0.0” and “:rest0.8”)

会有一股神秘感。 提交于 2020-01-15 09:55:39
问题 I am trying to import plugin "rest-client-builder:2.0.0" and ":rest0.8". I am running grails 2.3.2 I add the grails plugin into BuildConfig.groovy => compile ":rest-client-builder:2.0.0" Then i do "grails refresh-dependencies" Then go into the grails controller in and try to import grails.plugin.rest-client-builder and this fails.. I am using eclipse.. I can see the controller listed in my directory though but eclipse doesnt load it: Virals-MacBook-Pro:plugins viralcarpenter$ ls cache-1.1.1

Grails Service Transactions

一个人想着一个人 提交于 2020-01-15 09:51:49
问题 I'm trying to get transactions working within a Grails service, but I'm not getting the results I'm expecting. Can someone tell me if I'm doing something wrong, if my assumptions are off? My domain class: class Account { static constraints = { balance(min: 0.00) } String companyName BigDecimal balance = 0.00 Boolean active = true String toString() { return "${companyName} : ${balance}" } } My service: class AccountService { static transactional = true def transfer(Account source, Account

Grails Service Transactions

回眸只為那壹抹淺笑 提交于 2020-01-15 09:51:31
问题 I'm trying to get transactions working within a Grails service, but I'm not getting the results I'm expecting. Can someone tell me if I'm doing something wrong, if my assumptions are off? My domain class: class Account { static constraints = { balance(min: 0.00) } String companyName BigDecimal balance = 0.00 Boolean active = true String toString() { return "${companyName} : ${balance}" } } My service: class AccountService { static transactional = true def transfer(Account source, Account

Second level expand in gson

纵饮孤独 提交于 2020-01-15 09:23:05
问题 I'm using Grails 3.2.2 and org.grails.plugins:views-gradle:1.1.1 and in my section gson I'd like to expand all users and their carnets. I tried: import com.example.sections.Section model { Section section } json g.render(section, [excludes:['archived', 'deleted'], expand:['clients', 'clients.carnets']]){ } but it only expands clients in result json. how can I do that? btw carnets in Client domain class are transient. Is it possible to add transient variables to result gson? If so - how? 来源:

Grails - Making Methods Globally Available and Metaclass Programming

和自甴很熟 提交于 2020-01-15 08:15:42
问题 I inserted this line into my init() of my BootStrap class Integer.metaClass.minutes = { 60000L * delegate } I was then not able to use it from a Job class (Quartz plugin). Do I put this line of code somewhere else to make it a global modification? I was also wondering the best way to make a function available inside all classes in Grails. Like a global function. Would it be to extend the Object metaclass? or is there a better way? 回答1: Do I put this line of code somewhere else to make it a