« Return to Thread: "findOrCreateBy"

Re: "findOrCreateBy"

by Robert Fischer :: Rate this Message:

Reply to Author | View in Thread

That's true -- I could jack the map argument of findBy.  I'll probably go with that.

~~ Robert.

Moe wrote:

> Thats a good idea, the GORM labs and when it comes to the name of the
> method I think it sounds easy enough.
> On whether or not its necessary (although Robert don't want any input
> :P) I do think it would be good standard method for grails gorm, I am
> sure most folks have this code somewhere in their apps and should
> therefore be a standard one.
>
> def item = Item.findByName('someName') ?: new Item(name:'default',
> property:'something').save(flush:true)
>
> for example wouldn't work. It will return either true or false.
>
> I hope you will provide two maps, one to find by, and one with the
> "extra" properties to create by and the flush option :)
>
> Moe

--
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: "findOrCreateBy"