Quantcast

StackOverFlow.com <sql:query> Question?

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
I posted this question to StackOverFlow.com this morning.  I was wondering if anyone has a better "Grails" way to do a generic JSP <sql:query> in Grails.

http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails

-Mike


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Robert Fischer
If there *is* a way to do that, you shouldn't.  Why, oh why, are you putting SQL in your views?  Do
you just deep down hate yourself, or is there some other reason you've become self-destructive?

Michael Mellinger wrote:
> I posted this question to StackOverFlow.com this morning.  I was
> wondering if anyone has a better "Grails" way to do a generic JSP
> <sql:query> in Grails.
>
> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>
> -Mike
>

~~ Robert Fischer.
Smokejumper Consulting  http://smokejumperit.com
Enfranchised Mind Blog  http://enfranchisedmind.com/blog
LinkedIn Profile        http://www.linkedin.com/in/robertfischer
Twitter Feed            http://twitter.com/robertfischer

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Daniel Honig
Ha...."Do you just deep down hate yourself?"

There is never a good reason to do a query from a view.
On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
<[hidden email]> wrote:

> If there *is* a way to do that, you shouldn't.  Why, oh why, are you putting
> SQL in your views?  Do you just deep down hate yourself, or is there some
> other reason you've become self-destructive?
>
> Michael Mellinger wrote:
>>
>> I posted this question to StackOverFlow.com this morning.  I was wondering
>> if anyone has a better "Grails" way to do a generic JSP <sql:query> in
>> Grails.
>>
>>
>> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>>
>> -Mike
>>
>
> ~~ Robert Fischer.
> Smokejumper Consulting  http://smokejumperit.com
> Enfranchised Mind Blog  http://enfranchisedmind.com/blog
> LinkedIn Profile        http://www.linkedin.com/in/robertfischer
> Twitter Feed            http://twitter.com/robertfischer
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Erick Erickson
Daniel:

Does your comment also apply to, say, populating a dropdown from a domain?
If so, what is the "grailsy" way of doing it? Or you just talking about embedding
raw SQL? I'm not being contrarian here, just wondering....
e.g.

                    <g:select name="product"
                            from="${ConfigProductCode.listOrderByProductName()}"
                            optionValue="productName"
                            optionKey="productNumber"
                            value="${flash.product ? flash.product.toInteger() : 0}"/>


Thanks
Erick


On Wed, Nov 5, 2008 at 3:43 PM, Daniel Honig <[hidden email]> wrote:
Ha...."Do you just deep down hate yourself?"

There is never a good reason to do a query from a view.
On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
<[hidden email]> wrote:
> If there *is* a way to do that, you shouldn't.  Why, oh why, are you putting
> SQL in your views?  Do you just deep down hate yourself, or is there some
> other reason you've become self-destructive?
>
> Michael Mellinger wrote:
>>
>> I posted this question to StackOverFlow.com this morning.  I was wondering
>> if anyone has a better "Grails" way to do a generic JSP <sql:query> in
>> Grails.
>>
>>
>> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>>
>> -Mike
>>
>
> ~~ Robert Fischer.
> Smokejumper Consulting  http://smokejumperit.com
> Enfranchised Mind Blog  http://enfranchisedmind.com/blog
> LinkedIn Profile        http://www.linkedin.com/in/robertfischer
> Twitter Feed            http://twitter.com/robertfischer
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Daniel Honig
I would say typically that sort of  list data that defines choices
within a domain needs to be cached.

So long as you are using the domain objects you should be fine.

If you want to look at an example of an architectural style that does
not allow for any queries in view,
then you might look at the Barracuda web framework.  It enforces a "pull" model
where all resources for a request are assembled before view rendering.

I suppose the really alarming thing about the question was the mention
of direct sql.

On Wed, Nov 5, 2008 at 4:35 PM, Erick Erickson <[hidden email]> wrote:

> Daniel:
>
> Does your comment also apply to, say, populating a dropdown from a domain?
> If so, what is the "grailsy" way of doing it? Or you just talking about
> embedding
> raw SQL? I'm not being contrarian here, just wondering....
> e.g.
>
>                     <g:select name="product"
>
> from="${ConfigProductCode.listOrderByProductName()}"
>                             optionValue="productName"
>                             optionKey="productNumber"
>                             value="${flash.product ?
> flash.product.toInteger() : 0}"/>
>
>
> Thanks
> Erick
>
>
> On Wed, Nov 5, 2008 at 3:43 PM, Daniel Honig <[hidden email]> wrote:
>>
>> Ha...."Do you just deep down hate yourself?"
>>
>> There is never a good reason to do a query from a view.
>> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
>> <[hidden email]> wrote:
>> > If there *is* a way to do that, you shouldn't.  Why, oh why, are you
>> > putting
>> > SQL in your views?  Do you just deep down hate yourself, or is there
>> > some
>> > other reason you've become self-destructive?
>> >
>> > Michael Mellinger wrote:
>> >>
>> >> I posted this question to StackOverFlow.com this morning.  I was
>> >> wondering
>> >> if anyone has a better "Grails" way to do a generic JSP <sql:query> in
>> >> Grails.
>> >>
>> >>
>> >>
>> >> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>> >>
>> >> -Mike
>> >>
>> >
>> > ~~ Robert Fischer.
>> > Smokejumper Consulting  http://smokejumperit.com
>> > Enfranchised Mind Blog  http://enfranchisedmind.com/blog
>> > LinkedIn Profile        http://www.linkedin.com/in/robertfischer
>> > Twitter Feed            http://twitter.com/robertfischer
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list, please visit:
>> >
>> >   http://xircles.codehaus.org/manage_email
>> >
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Erick Erickson
<<<I would say typically that sort of  list data that defines choices
within a domain needs to be cached.>>>

Point taken. I have the extreme luxury of working on an in-house
application to support, maybe, 20 simultaneous users so I can cheat
a bit on something like this.

Thanks for the clarification...
Erick

On Wed, Nov 5, 2008 at 4:41 PM, Daniel Honig <[hidden email]> wrote:
I would say typically that sort of  list data that defines choices
within a domain needs to be cached.

So long as you are using the domain objects you should be fine.

If you want to look at an example of an architectural style that does
not allow for any queries in view,
then you might look at the Barracuda web framework.  It enforces a "pull" model
where all resources for a request are assembled before view rendering.

I suppose the really alarming thing about the question was the mention
of direct sql.

On Wed, Nov 5, 2008 at 4:35 PM, Erick Erickson <[hidden email]> wrote:
> Daniel:
>
> Does your comment also apply to, say, populating a dropdown from a domain?
> If so, what is the "grailsy" way of doing it? Or you just talking about
> embedding
> raw SQL? I'm not being contrarian here, just wondering....
> e.g.
>
>                     <g:select name="product"
>
> from="${ConfigProductCode.listOrderByProductName()}"
>                             optionValue="productName"
>                             optionKey="productNumber"
>                             value="${flash.product ?
> flash.product.toInteger() : 0}"/>
>
>
> Thanks
> Erick
>
>
> On Wed, Nov 5, 2008 at 3:43 PM, Daniel Honig <[hidden email]> wrote:
>>
>> Ha...."Do you just deep down hate yourself?"
>>
>> There is never a good reason to do a query from a view.
>> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
>> <[hidden email]> wrote:
>> > If there *is* a way to do that, you shouldn't.  Why, oh why, are you
>> > putting
>> > SQL in your views?  Do you just deep down hate yourself, or is there
>> > some
>> > other reason you've become self-destructive?
>> >
>> > Michael Mellinger wrote:
>> >>
>> >> I posted this question to StackOverFlow.com this morning.  I was
>> >> wondering
>> >> if anyone has a better "Grails" way to do a generic JSP <sql:query> in
>> >> Grails.
>> >>
>> >>
>> >>
>> >> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>> >>
>> >> -Mike
>> >>
>> >
>> > ~~ Robert Fischer.
>> > Smokejumper Consulting  http://smokejumperit.com
>> > Enfranchised Mind Blog  http://enfranchisedmind.com/blog
>> > LinkedIn Profile        http://www.linkedin.com/in/robertfischer
>> > Twitter Feed            http://twitter.com/robertfischer
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list, please visit:
>> >
>> >   http://xircles.codehaus.org/manage_email
>> >
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
In reply to this post by Robert Fischer
If I told you that I had a legacy app that used dozens of screens like this and the SQL was more complicated (multi-table joins) and I simply wanted to migrated some of the code to grails without doing a complete redesign/rewrite, would that make my question acceptable?  Isn't part of the attractiveness of Groovy/Grails is that you can migrate a Java/JSP more easily?  If I said, hey let's rewrite everything from scratch then we'd have to have the discussion: "Why not use Ruby/Rails or Python/Django?"

-Mike


On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer <[hidden email]> wrote:
If there *is* a way to do that, you shouldn't.  Why, oh why, are you putting SQL in your views?  Do you just deep down hate yourself, or is there some other reason you've become self-destructive?


Michael Mellinger wrote:
I posted this question to StackOverFlow.com this morning.  I was wondering if anyone has a better "Grails" way to do a generic JSP <sql:query> in Grails.

http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails

-Mike


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Robert Fischer
No, it wouldn't have made it acceptable.  Part of the attractiveness of Groovy/Grails is also its
MVC structure.  If you're just doing a bunch of raw SQL calls from the view, then you should be
having the discussion: "Why not use PHP or Perl?"

There's a lot of ways to do what you're trying to do.  One of the better ones is to put the SQL into
a service and route it via the controller.

~~ Robert.

Michael Mellinger wrote:

> If I told you that I had a legacy app that used dozens of screens like
> this and the SQL was more complicated (multi-table joins) and I simply
> wanted to migrated some of the code to grails without doing a complete
> redesign/rewrite, would that make my question acceptable?  Isn't part of
> the attractiveness of Groovy/Grails is that you can migrate a Java/JSP
> more easily?  If I said, hey let's rewrite everything from scratch then
> we'd have to have the discussion: "Why not use Ruby/Rails or Python/Django?"
>
> -Mike
>
>
> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     If there *is* a way to do that, you shouldn't.  Why, oh why, are you
>     putting SQL in your views?  Do you just deep down hate yourself, or
>     is there some other reason you've become self-destructive?
>
>
>     Michael Mellinger wrote:
>
>         I posted this question to StackOverFlow.com this morning.  I was
>         wondering if anyone has a better "Grails" way to do a generic
>         JSP <sql:query> in Grails.
>
>         http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>
>         -Mike
>
>

~~ Robert Fischer.
Smokejumper Consulting  http://smokejumperit.com
Enfranchised Mind Blog  http://enfranchisedmind.com/blog
LinkedIn Profile        http://www.linkedin.com/in/robertfischer
Twitter Feed            http://twitter.com/robertfischer

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
I could use Perl.  Pretty trivial there too.  I'll be done in 5 minutes.  However, I want to deploy one war to an application server.  I'll look into doing it as a service and route it via a controller.  Good to see the Smalltalk way is really starting to make inroads.

If anyone comes up with the 5 minute solution in Grails, send it my way.  Thanks.

-Mike


On Wed, Nov 5, 2008 at 5:35 PM, Robert Fischer <[hidden email]> wrote:
No, it wouldn't have made it acceptable.  Part of the attractiveness of Groovy/Grails is also its MVC structure.  If you're just doing a bunch of raw SQL calls from the view, then you should be having the discussion: "Why not use PHP or Perl?"

There's a lot of ways to do what you're trying to do.  One of the better ones is to put the SQL into a service and route it via the controller.

~~ Robert.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Daniel Honig
In reply to this post by Robert Fischer
I don't think grails is a good fit for such an application as far as
the normal approach to grails development.  That being said I think
you would want to take a look at GRAG.

And not to add insult to injury, but rather to add inspiration, I've
got a service running at an investment bank that uses NHibernate
against a complex schema such as the kind you've mentioned.  We wrote
our own generator to generate domain classes and mappings but GRAG
should get you most of the way there without needing to write such a
tool.   You may need to do some work tweaking the generated
mappings......

On Wed, Nov 5, 2008 at 5:35 PM, Robert Fischer
<[hidden email]> wrote:

> No, it wouldn't have made it acceptable.  Part of the attractiveness of
> Groovy/Grails is also its MVC structure.  If you're just doing a bunch of
> raw SQL calls from the view, then you should be having the discussion: "Why
> not use PHP or Perl?"
>
> There's a lot of ways to do what you're trying to do.  One of the better
> ones is to put the SQL into a service and route it via the controller.
>
> ~~ Robert.
>
> Michael Mellinger wrote:
>>
>> If I told you that I had a legacy app that used dozens of screens like
>> this and the SQL was more complicated (multi-table joins) and I simply
>> wanted to migrated some of the code to grails without doing a complete
>> redesign/rewrite, would that make my question acceptable?  Isn't part of the
>> attractiveness of Groovy/Grails is that you can migrate a Java/JSP more
>> easily?  If I said, hey let's rewrite everything from scratch then we'd have
>> to have the discussion: "Why not use Ruby/Rails or Python/Django?"
>>
>> -Mike
>>
>>
>> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
>> <[hidden email] <mailto:[hidden email]>>
>> wrote:
>>
>>    If there *is* a way to do that, you shouldn't.  Why, oh why, are you
>>    putting SQL in your views?  Do you just deep down hate yourself, or
>>    is there some other reason you've become self-destructive?
>>
>>
>>    Michael Mellinger wrote:
>>
>>        I posted this question to StackOverFlow.com this morning.  I was
>>        wondering if anyone has a better "Grails" way to do a generic
>>        JSP <sql:query> in Grails.
>>
>>
>>  http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>>
>>        -Mike
>>
>>
>
> ~~ Robert Fischer.
> Smokejumper Consulting  http://smokejumperit.com
> Enfranchised Mind Blog  http://enfranchisedmind.com/blog
> LinkedIn Profile        http://www.linkedin.com/in/robertfischer
> Twitter Feed            http://twitter.com/robertfischer
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Daniel Honig
Here is the grag homepage
http://grag.sourceforge.net/

On Wed, Nov 5, 2008 at 5:47 PM, Daniel Honig <[hidden email]> wrote:

> I don't think grails is a good fit for such an application as far as
> the normal approach to grails development.  That being said I think
> you would want to take a look at GRAG.
>
> And not to add insult to injury, but rather to add inspiration, I've
> got a service running at an investment bank that uses NHibernate
> against a complex schema such as the kind you've mentioned.  We wrote
> our own generator to generate domain classes and mappings but GRAG
> should get you most of the way there without needing to write such a
> tool.   You may need to do some work tweaking the generated
> mappings......
>
> On Wed, Nov 5, 2008 at 5:35 PM, Robert Fischer
> <[hidden email]> wrote:
>> No, it wouldn't have made it acceptable.  Part of the attractiveness of
>> Groovy/Grails is also its MVC structure.  If you're just doing a bunch of
>> raw SQL calls from the view, then you should be having the discussion: "Why
>> not use PHP or Perl?"
>>
>> There's a lot of ways to do what you're trying to do.  One of the better
>> ones is to put the SQL into a service and route it via the controller.
>>
>> ~~ Robert.
>>
>> Michael Mellinger wrote:
>>>
>>> If I told you that I had a legacy app that used dozens of screens like
>>> this and the SQL was more complicated (multi-table joins) and I simply
>>> wanted to migrated some of the code to grails without doing a complete
>>> redesign/rewrite, would that make my question acceptable?  Isn't part of the
>>> attractiveness of Groovy/Grails is that you can migrate a Java/JSP more
>>> easily?  If I said, hey let's rewrite everything from scratch then we'd have
>>> to have the discussion: "Why not use Ruby/Rails or Python/Django?"
>>>
>>> -Mike
>>>
>>>
>>> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
>>> <[hidden email] <mailto:[hidden email]>>
>>> wrote:
>>>
>>>    If there *is* a way to do that, you shouldn't.  Why, oh why, are you
>>>    putting SQL in your views?  Do you just deep down hate yourself, or
>>>    is there some other reason you've become self-destructive?
>>>
>>>
>>>    Michael Mellinger wrote:
>>>
>>>        I posted this question to StackOverFlow.com this morning.  I was
>>>        wondering if anyone has a better "Grails" way to do a generic
>>>        JSP <sql:query> in Grails.
>>>
>>>
>>>  http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>>>
>>>        -Mike
>>>
>>>
>>
>> ~~ Robert Fischer.
>> Smokejumper Consulting  http://smokejumperit.com
>> Enfranchised Mind Blog  http://enfranchisedmind.com/blog
>> LinkedIn Profile        http://www.linkedin.com/in/robertfischer
>> Twitter Feed            http://twitter.com/robertfischer
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
In reply to this post by Daniel Honig
I'll look into grag when I have time.  Thanks.  I could probably try  
groovlets.  They already work in my project.  Maybe with an HTML  
builder?  Netbeans has great JRuby support so I might try putting that  
in my Java project.  So many paths, so little time.

-Mike
Sent from my iPhone

On Nov 5, 2008, at 5:47 PM, "Daniel Honig" <[hidden email]>  
wrote:

> I don't think grails is a good fit for such an application as far as
> the normal approach to grails development.  That being said I think
> you would want to take a look at GRAG.
>
> And not to add insult to injury, but rather to add inspiration, I've
> got a service running at an investment bank that uses NHibernate
> against a complex schema such as the kind you've mentioned.  We wrote
> our own generator to generate domain classes and mappings but GRAG
> should get you most of the way there without needing to write such a
> tool.   You may need to do some work tweaking the generated
> mappings......
>
> On Wed, Nov 5, 2008 at 5:35 PM, Robert Fischer
> <[hidden email]> wrote:
>> No, it wouldn't have made it acceptable.  Part of the  
>> attractiveness of
>> Groovy/Grails is also its MVC structure.  If you're just doing a  
>> bunch of
>> raw SQL calls from the view, then you should be having the  
>> discussion: "Why
>> not use PHP or Perl?"
>>
>> There's a lot of ways to do what you're trying to do.  One of the  
>> better
>> ones is to put the SQL into a service and route it via the  
>> controller.
>>
>> ~~ Robert.
>>
>> Michael Mellinger wrote:
>>>
>>> If I told you that I had a legacy app that used dozens of screens  
>>> like
>>> this and the SQL was more complicated (multi-table joins) and I  
>>> simply
>>> wanted to migrated some of the code to grails without doing a  
>>> complete
>>> redesign/rewrite, would that make my question acceptable?  Isn't  
>>> part of the
>>> attractiveness of Groovy/Grails is that you can migrate a Java/JSP  
>>> more
>>> easily?  If I said, hey let's rewrite everything from scratch then  
>>> we'd have
>>> to have the discussion: "Why not use Ruby/Rails or Python/Django?"
>>>
>>> -Mike
>>>
>>>
>>> On Wed, Nov 5, 2008 at 3:39 PM, Robert Fischer
>>> <[hidden email] <mailto:[hidden email]
>>> >>
>>> wrote:
>>>
>>>   If there *is* a way to do that, you shouldn't.  Why, oh why, are  
>>> you
>>>   putting SQL in your views?  Do you just deep down hate yourself,  
>>> or
>>>   is there some other reason you've become self-destructive?
>>>
>>>
>>>   Michael Mellinger wrote:
>>>
>>>       I posted this question to StackOverFlow.com this morning.  I  
>>> was
>>>       wondering if anyone has a better "Grails" way to do a generic
>>>       JSP <sql:query> in Grails.
>>>
>>>
>>> http://stackoverflow.com/questions/265410/doing-a-generic-sqlquery-in-grails
>>>
>>>       -Mike
>>>
>>>
>>
>> ~~ Robert Fischer.
>> Smokejumper Consulting  http://smokejumperit.com
>> Enfranchised Mind Blog  http://enfranchisedmind.com/blog
>> LinkedIn Profile        http://www.linkedin.com/in/robertfischer
>> Twitter Feed            http://twitter.com/robertfischer
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>  http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Randall R Schulz
In reply to this post by Michael Mellinger-3
On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
> ... Good to see the Smalltalk way is really starting to make inroads.

Starting??? This is very far from being the first or even an early
spread of MVC beyond the Smalltalk realm! That's been going on for,
what, about 20 years?


> ...
>
> -Mike


Randall Schulz

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Mingfai
In reply to this post by Michael Mellinger-3
i think it's really a bad idea to use sql in view. if the data can be cached, it's better to do the query in a service and let the controller get data from the cache and pass to the view. If the data cannot be cached and you need to do query on every request, do a query in controller is acceptable to me.

however, as a framework, it should allow you to do bad things (if you hate yourself :-) ) I don't buy the concept that every application should be mandatory to use good practice. You just need to aware of the consequence of not using good practice. There are always cases that good practice doesn't fit. if a client (doesn't pay enough $ and/or give enough time) and doesn't mind about performance/scalability, it's quite reasonable to use a quick and dirty approach.

you could use inline Groovy SQL in GSP. http://www.ibm.com/developerworks/java/library/j-pg01115.html
 - you still use controller, and the controller get a dataSource injected.
 - the dataSource is passed to a view
 - in the view , you use Groovy SQL inline
    <%  def result = new Sql(dataSource).execute("select * from mytable") %>

you could even create your own tag lib to do the query simulate the JSTL. Unlike Java tag lib, It is very easy to use tag lib in Grails.

Please be warned again that your code will be hardly maintainable, it's probably harder to debug,(afaik, we can't run debugger in GSP) and you're making connection on every request that is a proven to be non-scalable.

regards,
mingfai

On Thu, Nov 6, 2008 at 6:41 AM, Michael Mellinger <[hidden email]> wrote:
I could use Perl.  Pretty trivial there too.  I'll be done in 5 minutes.  However, I want to deploy one war to an application server.  I'll look into doing it as a service and route it via a controller.  Good to see the Smalltalk way is really starting to make inroads.

If anyone comes up with the 5 minute solution in Grails, send it my way.  Thanks.

-Mike



On Wed, Nov 5, 2008 at 5:35 PM, Robert Fischer <[hidden email]> wrote:
No, it wouldn't have made it acceptable.  Part of the attractiveness of Groovy/Grails is also its MVC structure.  If you're just doing a bunch of raw SQL calls from the view, then you should be having the discussion: "Why not use PHP or Perl?"

There's a lot of ways to do what you're trying to do.  One of the better ones is to put the SQL into a service and route it via the controller.

~~ Robert.





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
In reply to this post by Randall R Schulz
Sorry, I guess I was being sarcastic.  When I get the "yuck I see SQL  
use mvc" to a question that I could solve in 5 minutes at least 3  
different ways, I lose my sense of humor.  Sorry for my impatience but  
if I can derive the result in less than 10 lines of SQL and I  
essentially want to create an html view of my results, with a few  
basic filters, I don't really see the need to reverse engineer the  
entire database into domain classes.

-Mike
Sent from my iPhone

On Nov 5, 2008, at 6:45 PM, Randall R Schulz <[hidden email]> wrote:

> On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
>> ... Good to see the Smalltalk way is really starting to make inroads.
>
> Starting??? This is very far from being the first or even an early
> spread of MVC beyond the Smalltalk realm! That's been going on for,
> what, about 20 years?
>
>
>> ...
>>
>> -Mike
>
>
> Randall Schulz
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Randall R Schulz
On Wednesday 05 November 2008 19:57, Michael Mellinger wrote:
> Sorry, I guess I was being sarcastic.  When I get the "yuck I see SQL
> use mvc" to a question that I could solve in 5 minutes at least 3
> different ways, I lose my sense of humor.  Sorry for my impatience
> but if I can derive the result in less than 10 lines of SQL and I
> essentially want to create an html view of my results, with a few
> basic filters, I don't really see the need to reverse engineer the
> entire database into domain classes.

It's analogous to the now very tiresome criticism levelled against any
application written using a sophisticated framework or library. The
canonical "Hello World" application is appallingly huge and its
start-up time is comparably disappointing.

But this is a false criticism. Large, sophisticated frameworks and
libraries aren't meant to simplify the creation of trivial
applications, they're meant to help the developer manage complexity,
adapt to evolving requirements and accommodate various aspects of
scalability.

In other words, complaining that Grails doesn't make the equivalent of a
PHP one-liner comparably simple is missing the point. Real, non-trivial
applications ultimately benefit much more from an infrastructure that
appears to be a burden, but only when viewed from the perspective of a
trivial requirement.


But seriously... SQL in your mark-up templates? Who is going to defend
that??


> -Mike
> Sent from my iPhone

Good for you. You can squeeze those who disagree with you into a tiny
little speck, a pixel, even; then nothing.


> On Nov 5, 2008, at 6:45 PM, Randall R Schulz wrote:
> > On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
> >> ... Good to see the Smalltalk way is really starting to make
> >> inroads.
> >
> > Starting??? This is very far from being the first or even an early
> > spread of MVC beyond the Smalltalk realm! That's been going on for,
> > what, about 20 years?


Randall Schulz

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
I asked how to do a trivial Java/JSP page in Grails, not a PHP app.  Can you imagine that there are thousands of Java/JSP programmers who would benefit from understanding the best way to solve the problem in Grails?  Can you also image that if people could move to Grails in smaller steps they might be more inclined to do so.  And, of course, you understand that in many large corporations it would simply be impossible to start a new Grails app from scratch without many months of debates and meetings.  Finally imagine that it's trivial to do some of the legacy Java/JSP stuff in a mixture of Groovy and/or Grails and add it to the legacy app (war file).  Now maybe the Groovy/Grails user base grows to something a little more meaningful.  

So, if people really want to help the Grails ecosystem, the next time someone asks a question, maybe people will skip the kool-aid speeches and simply provide a reasonable solution.  You are completely missing the viral ability for Groovy/Grails to become more widely used.

On Wed, Nov 5, 2008 at 11:12 PM, Randall R Schulz <[hidden email]> wrote:

It's analogous to the now very tiresome criticism levelled against any
application written using a sophisticated framework or library. The
canonical "Hello World" application is appallingly huge and its
start-up time is comparably disappointing.

But this is a false criticism. Large, sophisticated frameworks and
libraries aren't meant to simplify the creation of trivial
applications, they're meant to help the developer manage complexity,
adapt to evolving requirements and accommodate various aspects of
scalability.

In other words, complaining that Grails doesn't make the equivalent of a
PHP one-liner comparably simple is missing the point. Real, non-trivial
applications ultimately benefit much more from an infrastructure that
appears to be a burden, but only when viewed from the perspective of a
trivial requirement.


But seriously... SQL in your mark-up templates? Who is going to defend
that??


> -Mike
> Sent from my iPhone

Good for you. You can squeeze those who disagree with you into a tiny
little speck, a pixel, even; then nothing.


> On Nov 5, 2008, at 6:45 PM, Randall R Schulz wrote:
> > On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
> >> ... Good to see the Smalltalk way is really starting to make
> >> inroads.
> >
> > Starting??? This is very far from being the first or even an early
> > spread of MVC beyond the Smalltalk realm! That's been going on for,
> > what, about 20 years?


Randall Schulz

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Daniel Honig
Mike,
  I feel your pain man....

This list is a community of very talented folks that embrace grails
for being the distilled and concentrated embodiment of many, many best
practices.  It is unreasonable to expect the community to be receptive
to something the community is so strongly against....However you have
a point...Executing a SQL query and getting a DataTable like
representation that you can pass to a component is not idiomatic to
Grails, and nor is it idiomatic to Rails or Django for that reason.
Django does provide for more direct SQL access than the other
frameworks.  Still, the best forum for what you want is still:
http://forums.asp.net/

There are large architectural issues with building a framework like
grails and allowing the kind of functionality that you want.  Possibly
you could get a session from hibernate and allow an HQL query, but
still I don't think of it as good form.

Java and C# are great languages.  However, a great element of the
design of both of these languages is aimed at making them easily used
by a large body of developers.  In a sense both of them are a sort of
dumbed down Objective-C or C++.....So basically, if you got C++ and a
garbage collection library, then you can't argue that Java is more
powerful than C++.....

So the point is, that don't complain that Grails is a more powerful
framework but doesn't allow you to do things which are considered
wrong by most of the community.   There are good reasons why it is
hard to do bad things in a framework such as grails.   Haskell would
never be the beauty of a language that it is if it allowed side
effects or a void type.  However, Haskell is very more powerful of
language than Java(IMHO) and much more difficult to learn.


Adoption is an issue for Grails that I'm banging my head against.  I
constantly am encountering projects that should be grails apps but are
not.  I am not sure what the community and G2One can do to cross this
chasm but as I've recently been out talking to lots of different Java
web projects, I'm shocked that few of the technologists I've been
meeting consider Grails a serious web framework.  It  will take some
time and alot more evangelism than I'm currently seeing.  But I hope
it happens. Being able to build projects in Groovy and have access to
the Java body of content is a great Joy and makes my life as a
developer much better.

If you want to execute queries, get a datatable back and then render a grid,
this is your forum:
http://forums.asp.net/

On Wed, Nov 5, 2008 at 11:56 PM, Michael Mellinger
<[hidden email]> wrote:

> I asked how to do a trivial Java/JSP page in Grails, not a PHP app.  Can you
> imagine that there are thousands of Java/JSP programmers who would benefit
> from understanding the best way to solve the problem in Grails?  Can you
> also image that if people could move to Grails in smaller steps they might
> be more inclined to do so.  And, of course, you understand that in many
> large corporations it would simply be impossible to start a new Grails app
> from scratch without many months of debates and meetings.  Finally imagine
> that it's trivial to do some of the legacy Java/JSP stuff in a mixture of
> Groovy and/or Grails and add it to the legacy app (war file).  Now maybe the
> Groovy/Grails user base grows to something a little more meaningful.
> So, if people really want to help the Grails ecosystem, the next time
> someone asks a question, maybe people will skip the kool-aid speeches and
> simply provide a reasonable solution.  You are completely missing the viral
> ability for Groovy/Grails to become more widely used.
> On Wed, Nov 5, 2008 at 11:12 PM, Randall R Schulz <[hidden email]> wrote:
>>
>> It's analogous to the now very tiresome criticism levelled against any
>> application written using a sophisticated framework or library. The
>> canonical "Hello World" application is appallingly huge and its
>> start-up time is comparably disappointing.
>>
>> But this is a false criticism. Large, sophisticated frameworks and
>> libraries aren't meant to simplify the creation of trivial
>> applications, they're meant to help the developer manage complexity,
>> adapt to evolving requirements and accommodate various aspects of
>> scalability.
>>
>> In other words, complaining that Grails doesn't make the equivalent of a
>> PHP one-liner comparably simple is missing the point. Real, non-trivial
>> applications ultimately benefit much more from an infrastructure that
>> appears to be a burden, but only when viewed from the perspective of a
>> trivial requirement.
>>
>>
>> But seriously... SQL in your mark-up templates? Who is going to defend
>> that??
>>
>>
>> > -Mike
>> > Sent from my iPhone
>>
>> Good for you. You can squeeze those who disagree with you into a tiny
>> little speck, a pixel, even; then nothing.
>>
>>
>> > On Nov 5, 2008, at 6:45 PM, Randall R Schulz wrote:
>> > > On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
>> > >> ... Good to see the Smalltalk way is really starting to make
>> > >> inroads.
>> > >
>> > > Starting??? This is very far from being the first or even an early
>> > > spread of MVC beyond the Smalltalk realm! That's been going on for,
>> > > what, about 20 years?
>>
>>
>> Randall Schulz
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Graeme Rocher
In reply to this post by Michael Mellinger-3
Hi Michael,

Well if I was you and this is really a migration, why don't you just
keep the existing JSPs? Grails will resolve either JSP or GSP views so
you can continue using your hacked up JSPs and slowly migrate to a
better infrastructure

Cheers

On Thu, Nov 6, 2008 at 4:56 AM, Michael Mellinger
<[hidden email]> wrote:

> I asked how to do a trivial Java/JSP page in Grails, not a PHP app.  Can you
> imagine that there are thousands of Java/JSP programmers who would benefit
> from understanding the best way to solve the problem in Grails?  Can you
> also image that if people could move to Grails in smaller steps they might
> be more inclined to do so.  And, of course, you understand that in many
> large corporations it would simply be impossible to start a new Grails app
> from scratch without many months of debates and meetings.  Finally imagine
> that it's trivial to do some of the legacy Java/JSP stuff in a mixture of
> Groovy and/or Grails and add it to the legacy app (war file).  Now maybe the
> Groovy/Grails user base grows to something a little more meaningful.
> So, if people really want to help the Grails ecosystem, the next time
> someone asks a question, maybe people will skip the kool-aid speeches and
> simply provide a reasonable solution.  You are completely missing the viral
> ability for Groovy/Grails to become more widely used.
> On Wed, Nov 5, 2008 at 11:12 PM, Randall R Schulz <[hidden email]> wrote:
>>
>> It's analogous to the now very tiresome criticism levelled against any
>> application written using a sophisticated framework or library. The
>> canonical "Hello World" application is appallingly huge and its
>> start-up time is comparably disappointing.
>>
>> But this is a false criticism. Large, sophisticated frameworks and
>> libraries aren't meant to simplify the creation of trivial
>> applications, they're meant to help the developer manage complexity,
>> adapt to evolving requirements and accommodate various aspects of
>> scalability.
>>
>> In other words, complaining that Grails doesn't make the equivalent of a
>> PHP one-liner comparably simple is missing the point. Real, non-trivial
>> applications ultimately benefit much more from an infrastructure that
>> appears to be a burden, but only when viewed from the perspective of a
>> trivial requirement.
>>
>>
>> But seriously... SQL in your mark-up templates? Who is going to defend
>> that??
>>
>>
>> > -Mike
>> > Sent from my iPhone
>>
>> Good for you. You can squeeze those who disagree with you into a tiny
>> little speck, a pixel, even; then nothing.
>>
>>
>> > On Nov 5, 2008, at 6:45 PM, Randall R Schulz wrote:
>> > > On Wednesday 05 November 2008 14:41, Michael Mellinger wrote:
>> > >> ... Good to see the Smalltalk way is really starting to make
>> > >> inroads.
>> > >
>> > > Starting??? This is very far from being the first or even an early
>> > > spread of MVC beyond the Smalltalk realm! That's been going on for,
>> > > what, about 20 years?
>>
>>
>> Randall Schulz
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: StackOverFlow.com <sql:query> Question?

Michael Mellinger-3
In reply to this post by Daniel Honig
How will ASP.net help me if I'm running a J2EE App server?   You offered that as a solution twice.    I already know Perl so I know a GTD language, and I could set up Apache for when I need things done quickly.  Unfortunately,  Perl doesn't run on the JVM.  JPython, JRuby, Groovy or perhaps Scala will probably be better options in my future.

You should look at Eiffel.  It was a great language.  Unfortunately C++ was more of a  viral solution.  Perl took the same approach and it's still the most popular scripting language.  I'll use Grails where the problems fits the model and seek other solutions where appropriate.

-Mike


On Thu, Nov 6, 2008 at 1:45 AM, Daniel Honig <[hidden email]> wrote:
Mike,
 I feel your pain man....

This list is a community of very talented folks that embrace grails
for being the distilled and concentrated embodiment of many, many best
practices.  It is unreasonable to expect the community to be receptive
to something the community is so strongly against....However you have
a point...Executing a SQL query and getting a DataTable like
representation that you can pass to a component is not idiomatic to
Grails, and nor is it idiomatic to Rails or Django for that reason.
Django does provide for more direct SQL access than the other
frameworks.  Still, the best forum for what you want is still:
http://forums.asp.net/

There are large architectural issues with building a framework like
grails and allowing the kind of functionality that you want.  Possibly
you could get a session from hibernate and allow an HQL query, but
still I don't think of it as good form.

Java and C# are great languages.  However, a great element of the
design of both of these languages is aimed at making them easily used
by a large body of developers.  In a sense both of them are a sort of
dumbed down Objective-C or C++.....So basically, if you got C++ and a
garbage collection library, then you can't argue that Java is more
powerful than C++.....

So the point is, that don't complain that Grails is a more powerful
framework but doesn't allow you to do things which are considered
wrong by most of the community.   There are good reasons why it is
hard to do bad things in a framework such as grails.   Haskell would
never be the beauty of a language that it is if it allowed side
effects or a void type.  However, Haskell is very more powerful of
language than Java(IMHO) and much more difficult to learn.


Adoption is an issue for Grails that I'm banging my head against.  I
constantly am encountering projects that should be grails apps but are
not.  I am not sure what the community and G2One can do to cross this
chasm but as I've recently been out talking to lots of different Java
web projects, I'm shocked that few of the technologists I've been
meeting consider Grails a serious web framework.  It  will take some
time and alot more evangelism than I'm currently seeing.  But I hope
it happens. Being able to build projects in Groovy and have access to
the Java body of content is a great Joy and makes my life as a
developer much better.

If you want to execute queries, get a datatable back and then render a grid,
this is your forum:
http://forums.asp.net/



12
Loading...