grails

Grails, How Create Table in Run-time Using Dialect

无人久伴 提交于 2020-02-04 09:00:21
问题 Is it possible to create tables in run-time without being worry about create table proprietary syntax of different databases and other things that can be managed by GORM or Hibernate ? I need to create and manage somes table dynamically in run-time and don't need to ORM for them. 回答1: Hey it seems this question was asked in the question how can i create a dynamic domain class in grails. Yet Burt's answer of the dynamic domain class plugin seems to be abandoned. I would recommend using raw SQL

Adding changes listeners in Grails' GORM

淺唱寂寞╮ 提交于 2020-02-02 13:38:29
问题 I'm new to Grails and I'm using Grails 2.0.1. I want to add a persistence event listener for changes in objects for a domain class, so I tried the code in Bootstrap.groovy as given in the user guide: def init = { applicationContext.addApplicationListener(new FooBarListener()) } And I get the following error message: ERROR context.GrailsContextLoader - Error executing bootstraps: No such property: applicationContext for class: BootStrap How can I get the applicacionContext property from inside

Grails - stop or reschedule a job

旧巷老猫 提交于 2020-02-02 07:54:25
问题 I am dynamically scheduling jobs, at this way: JobClass.schedule(Long interval, Integer repeatCount, Map params ) Later I want to stop the job from running, and then restart them again according to the users actions. How could I stop this trigger? The only way that did actually stop it was JobClass.removeJob() , but I wasn;t able to start it again later, so I need something else. Thanks! 回答1: you can use Scheduler class having methods unscheduleJob which just delete all the triggers bind with

Grails - stop or reschedule a job

谁说我不能喝 提交于 2020-02-02 07:54:08
问题 I am dynamically scheduling jobs, at this way: JobClass.schedule(Long interval, Integer repeatCount, Map params ) Later I want to stop the job from running, and then restart them again according to the users actions. How could I stop this trigger? The only way that did actually stop it was JobClass.removeJob() , but I wasn;t able to start it again later, so I need something else. Thanks! 回答1: you can use Scheduler class having methods unscheduleJob which just delete all the triggers bind with

How to fetch records in grails by max date and group at same time

╄→гoц情女王★ 提交于 2020-02-02 02:20:15
问题 I have a table that looks like this: id name shade date_created ---- ----- ------- --------------- 1 Red bright 10-28-2012 2 Orange light 10-28-2012 3 Red <null> 10-24-2013 4 Orange light 10-24-2013 Desired Result: id name value date_created ---- ----- ------ --------- 3 Red <null> 10-24-2013 4 Orange light 10-24-2013 What can I do with GORM to get this result? In pure sql this is the query that gets me the desired result: SELECT t.name, t.shade, r.MaxTime FROM (SELECT name, MAX(date_created)

Grails filter syntax, or, How to call a Grails Filter outside Grails

元气小坏坏 提交于 2020-01-31 09:17:04
问题 Grails provides filters that run before your controllers. They're defined in classes that look like this: class SecurityFilters { def filters = { myFilter(controller:'*', action:'*') { // What are those weird colons?? print "I'm filtering!" // Code that does the filtering goes here } } } These work great but I would like to understand the syntax better as it doesn't look like any Groovy code I've seen before. In particular, the line above that starts with myFilter seems very odd. Is this a

Grails filter syntax, or, How to call a Grails Filter outside Grails

天大地大妈咪最大 提交于 2020-01-31 09:14:09
问题 Grails provides filters that run before your controllers. They're defined in classes that look like this: class SecurityFilters { def filters = { myFilter(controller:'*', action:'*') { // What are those weird colons?? print "I'm filtering!" // Code that does the filtering goes here } } } These work great but I would like to understand the syntax better as it doesn't look like any Groovy code I've seen before. In particular, the line above that starts with myFilter seems very odd. Is this a

grails session creation, on how to prevent it

天涯浪子 提交于 2020-01-30 11:33:28
问题 in the last line in the following bug report https://github.com/grails/grails-core/issues/5296 it is stated that; In an ideal world, it would be possible to turn off HttpSession creation for a whole Controller (all actions) and also turn them off for a particular set of actions. This is however, a quite old bugreport, so my question is: is this possible in an upcoming or todays version (1.3.7) of grails? If not, shouldn't it be? The reason i seek this kind of behavior is due to development of

In grails, how do I get a reference to all current sessions?

一曲冷凌霜 提交于 2020-01-30 04:41:39
问题 I'd like to list all current sessions in an Admin Controller in grails. What's the easiest way to get a reference to e.g. a Collection of sessions from the controller? 回答1: This is a feature (disabled by default but easily enabled by setting grails.plugins.appinfo.useContextListener = true in Config.groovy) of the App-Info plugin: http://grails.org/plugin/app-info 回答2: there is a "groovy" way to do this without a SessionListener, there are events generated that closures can be assigned to.

In grails, how do I get a reference to all current sessions?

五迷三道 提交于 2020-01-30 04:41:13
问题 I'd like to list all current sessions in an Admin Controller in grails. What's the easiest way to get a reference to e.g. a Collection of sessions from the controller? 回答1: This is a feature (disabled by default but easily enabled by setting grails.plugins.appinfo.useContextListener = true in Config.groovy) of the App-Info plugin: http://grails.org/plugin/app-info 回答2: there is a "groovy" way to do this without a SessionListener, there are events generated that closures can be assigned to.