|
Hi,
Is it possible to specify an optional relationship in Grails? What I have in mind is something like: class Role { Project project String name static constraints = { project(nullable: true) } } where some roles are associated with projects, while others are system-wide (project = null). Is the above even allowed by databases themselves? Thanks, Peter --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
it is a FK that can be null on your role table and yes most DBs are
supporting - I would say all of them. GORM however does not yet (I think there is JIRA for it). On 3/30/07, Peter Ledbrook <[hidden email]> wrote: > Hi, > > Is it possible to specify an optional relationship in Grails? What I > have in mind is something like: > > class Role { > Project project > String name > > static constraints = { > project(nullable: true) > } > } > > where some roles are associated with projects, while others are > system-wide (project = null). Is the above even allowed by databases > themselves? > > Thanks, > > Peter > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > -- Thanks, Alex. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
On 30/03/07, Alex Shneyderman <[hidden email]> wrote:
> it is a FK that can be null on your role table and yes most DBs are > supporting - I would say all of them. GORM however does not yet (I > think there is JIRA for it). > Thanks for the info, Peter --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
Hi all,
i'm completely new to grails and I've been reading and doing all the examples from the website. Can anybody provide some good reference or tutorial with lots of examples? Thanks, Marc
Get your own web address. Have a HUGE year through Yahoo! Small Business. |
|
In reply to this post by pledbrook
you know I said something entirely stupid in my reply. My apologies.
You surely can do that. Now. You just need to set project to null and your Role will be disassociated form any project. So nullable realtion is possible. Sorry for confusion. On 3/30/07, Peter Ledbrook <[hidden email]> wrote: > Hi, > > Is it possible to specify an optional relationship in Grails? What I > have in mind is something like: > > class Role { > Project project > String name > > static constraints = { > project(nullable: true) > } > } > > where some roles are associated with projects, while others are > system-wide (project = null). Is the above even allowed by databases > themselves? > > Thanks, > > Peter > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > -- Thanks, Alex. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Marc Lester Tan
Marc Lester Tan wrote:
> Hi all, > > i'm completely new to grails and I've been reading and doing all the > examples from the website. Can anybody provide some good reference or > tutorial with lots of examples? > This is really useful: http://www.infoq.com/minibooks/grails --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Marc Lester Tan
I bought The
Definitive Guide to Grails as an ebook last week and whole heartily recommend
it. And only 20 dollars! Regards, Jimmy From: Marc
Lester Tan [mailto:[hidden email]] Hi all, Get
your own web address. |
|
In reply to this post by a.shneyderman
On 30/03/07, Alex Shneyderman <[hidden email]> wrote:
> you know I said something entirely stupid in my reply. My apologies. > > You surely can do that. Now. You just need to set project to null and > your Role will > be disassociated form any project. So nullable realtion is possible. > Sorry for confusion. Well, when I create a new Role object without giving a project, the save() throws an error (non-null constraint violation or something like that). This is with a 0.5 version from a few weeks back. Maybe this behaviour broke somehow? Cheers, Peter --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
Peter Ledbrook wrote:
> On 30/03/07, Alex Shneyderman <[hidden email]> wrote: >> you know I said something entirely stupid in my reply. My apologies. >> >> You surely can do that. Now. You just need to set project to null and >> your Role will >> be disassociated form any project. So nullable realtion is possible. >> Sorry for confusion. > > Well, when I create a new Role object without giving a project, the > save() throws an error (non-null constraint violation or something > like that). This is with a 0.5 version from a few weeks back. Maybe > this behaviour broke somehow? > though Grails would not now create one? What db are you using? I have certainly found in the past with Hibernate (v2) and MySQL that I have sometimes had to go in and tinker with the database after making constraint changes in Hibernate. It seems much better at putting things there than taking them away again when not needed. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
> Could it be that the constraint is still there in the database, even
> though Grails would not now create one? What db are you using? I have > certainly found in the past with Hibernate (v2) and MySQL that I have > sometimes had to go in and tinker with the database after making > constraint changes in Hibernate. It seems much better at putting things > there than taking them away again when not needed. That looks like it - thanks John! I dropped the table and re-ran "grails run-app" - I can now have null project values. Cheers, Peter --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
Side note - by default relationships are marked as nullable now (0.5), not like other properties which are required by default. This probably will be fixed soon.
Cheers 2007/3/30, Peter Ledbrook <
[hidden email]>: > Could it be that the constraint is still there in the database, even -- Sergey Nebolsin |
|
In reply to this post by Coyne, Jimmy-2
> I bought The Definitive Guide to Grails as an ebook last week and whole
> heartily recommend it. And only 20 dollars! I own that e-Book and a paper copy of Jason's book "Getting Started with Grails". (See the InfoQ link in a previous post). For a newbie, I thoroughly recommend "Getting Started with Grails". (The PDF is free and the paper copy is pretty cheap, too). I've knocked up a live CRUD app for my main employer using just that book. It walks you through building an application at a sensible pace, without assuming you're some sort of Java guru. ;-) I'd especially recommend it to people coming from a LAMP background. Once you need to do something a bit more complex, "The Definitive Guide..." works like an educational reference. It explains the more esoteric (well, things that may not appear in a simple CRUD app, anyway) bits and pieces well. nic --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Marc Lester Tan
On 3/30/07, Marc Lester Tan <[hidden email]> wrote:
Hi all, This isn't exactly what you're looking for but it may be useful. It's an internal reference doc I threw together while finding my way around Grails. http://www.masukomi.org/writings/grails_crash_course.html -- - kate = masukomi http://weblog.masukomi.org/ |
|
kate, that's a really good quick reference! Thanks.
On 31/03/07, kate rhodes <[hidden email]> wrote: > On 3/30/07, Marc Lester Tan <[hidden email]> wrote: > > Hi all, > > > > i'm completely new to grails and I've been reading and doing all the > examples from the website. Can anybody provide some good reference or > tutorial with lots of examples? > > > > This isn't exactly what you're looking for but it may be useful. It's an > internal reference doc I threw together while finding my way around Grails. > http://www.masukomi.org/writings/grails_crash_course.html > > -- > - kate = masukomi > http://weblog.masukomi.org/ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Coyne, Jimmy-2
At 04:12 AM 3/30/2007, you wrote:
>I bought ><http://www.apress.com/book/supplementDownload.html?bID=10205&sID=4004>The >Definitive Guide to Grails as an ebook last week and whole heartily >recommend it. And only 20 dollars! i have the printed version of both. does the e-book promise any updates? thanks --- vice-chair http://ocjug.org/ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Marc Lester Tan
There was never any mention of an update unfortunately. -----Original Message-----
At 04:12 AM 3/30/2007, you wrote:
i have the printed version of both. does the e-book promise any updates? thanks ---
---------------------------------------------------------------------
|
|
Jason has updated the source code for 0.4.2, though. See his webpage
at http://www.jasonrudolph.com/ .
Ken Kenneth A. Kousen President Kousen IT, Inc. Email: [hidden email] Site: http://www.kousenit.com Blog: http://kousenit.wordpress.com Coyne, Jimmy wrote: --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
At 07:54 AM 4/1/2007, you wrote:
>Jason has updated the source code for 0.4.2, though. See his >webpage at <http://www.jasonrudolph.com/>http://www.jasonrudolph.com/ . great! thanks >Coyne, Jimmy wrote: >> >>There was never any mention of an update unfortunately. >> >>-----Original Message----- >>From: Ray Tayek [<mailto:[hidden email]>mailto:[hidden email]] >>Sent: Saturday, March 31, 2007 5:24 AM >>To: <mailto:[hidden email]>[hidden email] >>Subject: RE: [grails-user] Tutorial for newbie >> >>At 04:12 AM 3/30/2007, you wrote: >> >I bought >> ><<http://www.apress.com/book/supplementDownload.html?bID=10205&sID >> =4004>http://www.apress.com/book/supplementDownload.html?bID=10205&sID=4004>The >> >> >Definitive Guide to Grails as an ebook last week and whole heartily >> >recommend it. And only 20 dollars! >> >>i have the printed version of both. does the e-book promise any updates? ... > >--- >vice-chair http://ocjug.org/ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Coyne, Jimmy-2
Thanks to all those who replied. I bought the [DG] Grails and it is really helpful. I've been trying to create a CMS using Struts 2 + Spring + JPA for almost 2 weeks now and I tried creating another version of CMS reusing the same model using Grails and it just took me about only 2 days to finish it!!! If there are newbies like me out there, I would recommend buying the book also as well as the one on johnrudolph site. thanks, Marc "Coyne, Jimmy" <[hidden email]> wrote:
TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. |
| Powered by Nabble | Edit this page |
