grails

grails one to many with additional column

妖精的绣舞 提交于 2020-01-06 20:52:13
问题 In my Grails project I need to have a 1:N relationship between two domain classes. So, I've created the following domain class: class Receipt_HealthService { Receipt receipt HealthService healthService int quantity = 1 static constraints = { } } and in Receipt I have the following: @NotNull static hasMany = [healthServices:Receipt_HealthService] So a new table is created that has got the id of both domain class and the quantity field. When I call the save() method everything works well, but

Spring dependency injection not completing in time

故事扮演 提交于 2020-01-06 19:26:39
问题 All, I'm setting up a Spring IOC container using dependency injection, etc. I'm running into a very bizarre behavior where it seems that some beans in a collection get fully initialized before use while others don't. The weird part is that all of these beans share the same superclass and the failed dependency injection is happening in one of the superclass dependencies. Here is the example: @Component class Bar { void doSomething() { // do something } } class Foo { @Autowired Bar bar }

Persist a list of LocalDate with GORM

扶醉桌前 提交于 2020-01-06 16:19:22
问题 I'm trying to persist a list of joda LocalDate in grails. What I have right now is something like this: package com.publidirecta import org.joda.time.LocalDate class Evento { List <LocalDate> fechas = [] static hasMany = [fechas:LocalDate] } and I get the following error : MappingException: Missing type or column for column[fechas_persistent_local_date] on domain[Evento] referencing[org.jadira.usertype.dateandtime.joda.PersistentLocalDate] ->> 334 | innerRun in java.util.concurrent.FutureTask

Persist a list of LocalDate with GORM

為{幸葍}努か 提交于 2020-01-06 16:19:01
问题 I'm trying to persist a list of joda LocalDate in grails. What I have right now is something like this: package com.publidirecta import org.joda.time.LocalDate class Evento { List <LocalDate> fechas = [] static hasMany = [fechas:LocalDate] } and I get the following error : MappingException: Missing type or column for column[fechas_persistent_local_date] on domain[Evento] referencing[org.jadira.usertype.dateandtime.joda.PersistentLocalDate] ->> 334 | innerRun in java.util.concurrent.FutureTask

Control server side caching by page (Tomcat)?

血红的双手。 提交于 2020-01-06 16:01:09
问题 I'm working with a grails application deployed in tomcat6, and I want to be able to enable or disable server side page caching on a "page by page" basis. In other words, I want to be able to specify, "Cache page A, but do not cache pages B and C." Is such a thing possible? If so, what is the best way to do this? Thanks in advance. 回答1: The Spring Cache plugin lets you cache controller actions and service method calls, so you could annotate the cacheable pages/actions and leave the ones that

Passing session value from controller to src/groovy class

六月ゝ 毕业季﹏ 提交于 2020-01-06 15:52:11
问题 I have set a variable in my controller class in session as follows: session.webURL = webURL println "#####" + session.webURL` Now, I want to use this value of webURL in my src/groovy class. So I wrote in my src/groovy BasicCrawler class: println session.webURL It shows me an error: Message: 'No such property: session for class: cmsprofiler.BasicCrawler' at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) Please tell me what I am doing wrong. Thanks a lot

How to configure Grails to avoid deletion of uploaded images when redeploy in a Tomcat server

允我心安 提交于 2020-01-06 15:01:01
问题 I have been reading about the best place to save images uploaded by users. In my case, I think it is better to store these images in the filesystem. I want to store them in the same server and keep it easy to mantain by other administrators. Is it possible to set the upload folder inside the application context and configure Grails in order to not delete that folder when redeploying a new war? If not, I wonder if the next code (gotten here by @yecid) would work as I think it uploads the

How to configure Grails to avoid deletion of uploaded images when redeploy in a Tomcat server

别来无恙 提交于 2020-01-06 14:59:01
问题 I have been reading about the best place to save images uploaded by users. In my case, I think it is better to store these images in the filesystem. I want to store them in the same server and keep it easy to mantain by other administrators. Is it possible to set the upload folder inside the application context and configure Grails in order to not delete that folder when redeploying a new war? If not, I wonder if the next code (gotten here by @yecid) would work as I think it uploads the

How does Grails handle security, and why should I use a plugin?

我怕爱的太早我们不能终老 提交于 2020-01-06 14:21:12
问题 For 90% of every security-related Grails tutorial, they tell you to store your User objects in a session-scoped variable. That's all nice and easy, but I wonder if it's too good to be true, especially with plugins like Spring Security that offer many times more features. For the simple, "I am a user and therefore I am entitled to view/edit my own domain objects" applications that I develop, I store my User objects in a session. However, this got me thinking how Grails supports J2EE security

Q: Grails2.4, CAS and the infamous redirect loop

点点圈 提交于 2020-01-06 14:03:56
问题 I have several Grails applications running in production and interfacing to a CAS server (CAS 3.3.5) via spring-security and the "Grails CAS plugin". These applications are supported by various versions of Grails from version 1.3.7 to 2.2.4 I am moving one of them to 2.4.4 and I have never ending problems with the authentication. At the end of the exercise I have the notorious: "This webpage has a redirect loop" (in Chrome). At the server side I have the usual (!) error: ERROR [org.jasig.cas