grails

Grails GORM: How do I create a composite primary key and use it for a table relationship?

倾然丶 夕夏残阳落幕 提交于 2020-01-11 10:55:28
问题 I have two tables, one of which (legacy table: A) has two fields that should serve as a composite foreign key and the other one (new table: B) should use a composite primary key for a each row:A has one row:B relationship. How do I describe these tables in terms of GORM? So far I've been able to create a domain class that reflects the legacy table:A class A { ... //composite foreign key to link B class String className; String eventName; B b; //instance of B to be related static mapping = {

Grails GORM: How do I create a composite primary key and use it for a table relationship?

删除回忆录丶 提交于 2020-01-11 10:55:25
问题 I have two tables, one of which (legacy table: A) has two fields that should serve as a composite foreign key and the other one (new table: B) should use a composite primary key for a each row:A has one row:B relationship. How do I describe these tables in terms of GORM? So far I've been able to create a domain class that reflects the legacy table:A class A { ... //composite foreign key to link B class String className; String eventName; B b; //instance of B to be related static mapping = {

How to add source folder to grails application

≯℡__Kan透↙ 提交于 2020-01-11 10:07:28
问题 I use STS for developing Grails application, and I need to use there a bunch of classes generated by wsimport utility. In order to not to mix my source with autogenerated source, I want to add separate directory and put there generated classes, like this: grails-project | |-- .classpath |-- .groovy |-- .project |-- .settings |-- application.properties |-- grails-app |-- lib |-- scripts |-- src | |-- groovy | |-- java | `-- wsimport <- where I want to make additional source folder |-- target |

How to refactor common Geb test sequences

浪子不回头ぞ 提交于 2020-01-11 09:41:29
问题 Suppose I have multiple Geb/Spock tests that beings with logging in. For example: @Stepwise Class AddNewPictureSpec extends GebSpec { def "User at login page"() { given: "User beings from login page" to LoginPage } def "User gets redirected to Main page"() { given: "User at Login page" at LoginPage when: "User signs in" signIn "username", "pw" to MainPage then: at MainPage def "other test sequences follow...."() { } } And another test spec with the exact same start sequence: @Stepwise Class

Grails 3.x: Re-using JPA/Hibernate Domain classes: Domain class not found

六眼飞鱼酱① 提交于 2020-01-11 09:25:22
问题 I have a Spring 4.1.0 back-end application with domain classes annotated in JPA (w/Hibernate 4.3.5 as the persistence provider) using Maven as the build tool. I now want to add a web front-end component to this app and have decided to use Grails 3.x as my web framework. I want to re-use my existing JPA annotated domain classes with Grails and then use generate-all to create controllers and views for each domain model. My first milestone goal is to get basic CRUD functionality on the old

Grails Url shortener plugin not getting installed

喜夏-厌秋 提交于 2020-01-11 06:47:07
问题 I am trying to add a new plugin mentioned here in my app but it is not been resolved and giving me a error i.e. :: problems summary :: :::: WARNINGS module not found: org.grails.plugins#url-shortener;0.2.1 ==== grailsPlugins: tried -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: ... ==== grailsHome: tried /opt/grails/lib/org.grails.plugins/url-shortener/ivy-0.2.1.xml -- artifact org.grails.plugins#url-shortener;0.2.1!url-shortener.zip: /opt/grails/lib/org.grails.plugins

Why does my Geb test return “failed to create driver from callback” even after updating my Selenium dependency in Grails?

99封情书 提交于 2020-01-11 06:23:31
问题 I am referencing this previous thread (geb.driver.DriverCreationException: failed to create driver from callback) - but am still having problems. I am trying to run Geb functional tests under Grails 2.4.3 and I have my Selenium support dependency set to version 2.42.2. I've also tried it with 2.43.1 and 2.45.0. Geb will stall out and not finish if I try Selenium 2.42.2 or 2.43.1, and it will outright crash if I use 2.45.0. These are the errors I get: If I try Selenium support 2.42.2 or 2.43.1

Way to deep traverse a Groovy object with dot in string using GPath

蹲街弑〆低调 提交于 2020-01-11 06:07:56
问题 The situation I have is that I'm querying MongoDB with a string for a field that is more than one level deep in the object hierarchy. This query must be a string. So for example I'm querying for something like this in Groovy: def queryField = 'a.b.c' //this is variable and can be different every time def result = mongodb.collection.findOne([queryField:5]) The problem no arises that in the result I want to find the value of the nested field. With GPath I could go one level deep and get a's

Way to deep traverse a Groovy object with dot in string using GPath

南楼画角 提交于 2020-01-11 06:07:31
问题 The situation I have is that I'm querying MongoDB with a string for a field that is more than one level deep in the object hierarchy. This query must be a string. So for example I'm querying for something like this in Groovy: def queryField = 'a.b.c' //this is variable and can be different every time def result = mongodb.collection.findOne([queryField:5]) The problem no arises that in the result I want to find the value of the nested field. With GPath I could go one level deep and get a's

Way to deep traverse a Groovy object with dot in string using GPath

旧街凉风 提交于 2020-01-11 06:05:49
问题 The situation I have is that I'm querying MongoDB with a string for a field that is more than one level deep in the object hierarchy. This query must be a string. So for example I'm querying for something like this in Groovy: def queryField = 'a.b.c' //this is variable and can be different every time def result = mongodb.collection.findOne([queryField:5]) The problem no arises that in the result I want to find the value of the nested field. With GPath I could go one level deep and get a's