300+ TOP Groovy On Grails Interview Questions [REAL TIME]

  1. 1. What’s Is Groovy?

    is an dynamic, object oriented, scripting language that it’s compiled in byte code and runs over the JVM. this language include some features like metha programing, closures, etc.

  2. 2. What Is Grails?

    Grails is an open source web application framework that uses the Groovy and Java as programming language, this framework use another frameworks like Spring, Hibernate, SiteMesh and have an embedded H2 database, Tomcat server and ORM(GORM). this framework follow some design patterns as Model View Controller(MVC), Convention Over Configuration(CoC), Don’t repeat yourself(DRY) and runs over the Java Virtual Machine(JVM).


  3. Web Services Interview Questions

  4. 3. What Is Orm?

    means object relational mapping, A simple answer is that you wrap your tables or stored procedures in classes in your programming language, so that instead of writing SQL statements to interact with your database, you use methods and properties of objects.

    It’s a library or framework that help you to map/convert your models in to tables in your database, It’s like a mediator or an intermediate that avoid that you have to write SQL code and allows you to interact with the DB using a programming language like groovy without have to worry about write SQL code or what kind of database are you using, you can switch from mySql to Oracle DB modifying only 4 lines of code, an example of what is an ORM It’s the Hibernate Framework.

  5. 4. What Is Gorm?

    GORM is Grails’ object relational mapping (ORM) implementation. Under the hood it uses Hibernate (a very popular and flexible open source ORM solution) and thanks to the dynamic nature of Groovy with its static and dynamic typing, along with the convention of Grails, there is far less configuration involved in creating Grails domain classes.


  6. Web Services Tutorial

  7. 5. What Is The Command To Create A New Application In Grails?

    grails create-app “the name of your app”


  8. HTML 5 Interview Questions

  9. 6. What Is The Command To Run A Grails Application?

    grails run-app

  10. 7. What Is The Command To Create A Domain Class?

    Grails create-domain-class “package” +”name of your domain class”.


  11. HTML 5 Tutorial
    J2EE Interview Questions

  12. 8. What Is The Command To Create A Controller?

    grails create-controller  “package” +”name of your domain class”

  13. 9. What Are The Default Environments In Grails?

    Development, Test And Production


  14. Angular JS Interview Questions

  15. 10. What Is The Command To Generate A War File?

    grails war


  16. J2EE Tutorial

  17. 11. What Is The Command To Run Your Application In A Different Environment That Development?

    grails  -Dgrails.env=test run-app


  18. CSS Advanced Interview Questions

  19. 12. What Is The Command To Run You Application In A Different Port Than 8080?

    grails  -Dserver.port=9090 run-app


  20. Web Services Interview Questions

  21. 13. What Is The Command To Do Static Scaffolding Of A Controller?

    grails generate-controller “packpage”+”domain class”


  22. CSS Advanced Tutorial

  23. 14. What Is The Command To Do Static Scaffolding Of The View Of A Domain?

    grails generate-views “packpage”+”domain class”

  24. 15. What Is The Command To Generate The Static Scaffolding Of The Controllers And Views Of A Domain Class?

    rails generate-all “packpage”+”domain class”


  25. Javascript Advanced Interview Questions

  26. 16. What Is The Command To Generate The Static Scaffolding Of The Controllers And Views Of All Your Domain Classes?

    grails generate-all “*”


  27. Javascript Advanced Tutorial

  28. 17. What Is The Command To Stop Your Application?

    grails stop-app


  29. Restful web service Interview Questions

  30. 18. What Is The Command To Test Your Application For Unit Test Only?

    grails test-app –unit


  31. HTML 5 Interview Questions

  32. 19. What Is The Command To Test Your Application For Integration Test Only?

    grails test-app –integration


  33. Restful web service Tutorial

  34. 20. What Is The Command To Rerun Test In Your Application?

    grails test-app –rerun


  35. Groovy (programming language) Interview Questions

  36. 21. What Is The Command To See Your Grails Version?

    grails  -version

  37. 22. What Is The Command To Create The Unit Test Of A Domain Class?

    grails create-unit-test “packpage”+”domain class”

  38. 23. What Is The Command To Create The Integration Test Of A Domain Class?

    grails create-integration-test “packpage”+”domain class”


  39. Advanced jQuery Interview Questions

  40. 24. What Is Data Binding?

    It’s the act of binding incoming request parameters on to the properties of an object.


  41. J2EE Interview Questions

  42. 25. Where Do You Setup Your Db , Hibernate Version And Environments?

    DataSource.groovy

  43. 26. Where Do You Setup Your Dependency Manager, Your Repositories, Dependencies And Plugins?

    BuildConfig.groovy


  44. Restaurant Manager Interview Questions

  45. 27. What Is The Difference Between Buildconfig.groovy And Config.groovy?

    that Config include configuration needed to run your application and BuildConfig include configuration to build and deploy your application.


  46. Angular JS Interview Questions

  47. 28. What Do You Have To Do If You Don’t Want That A Property Of Your Domain Be Mapped To The Db?

    in your domain class:

    static transient[‘can’t save this’]

  48. 29. What Is Metaprogramming?

    It’s the groovy ability to add new methods or variables to classes dynamically at run time, and without touching the code.


  49. Soap Web Services Interview Questions

  50. 30. Could You Give Me An Example Of Meta Programming In Grails?

    The dynamic finders in the domains class.

  51. 31. What Is Pessimistic Locking?

    Locking a row until the current transaction is completed. This has the implication that other read operations will be blocking until the lock is released.

  52. 32. How Do You Configuring Eager Fetching In A Domain Class?

    lazy: false

    or

    fetch: ‘join’

    Example:

    class Airport {

        String name

        static hasMany = [flights: Flight]

        static mapping = {

            flights lazy: false //here you configure eager fetching

        }

    }

    class Person {

        String firstName

        Pet pet

        static hasMany = [addresses: Address]

        static mapping = {

            addresses lazy: false

            pet fetch: ‘join’ //this is another way to configure eager fetching

        }

    }


  53. Java 9 Interview Questions

  54. 33. What Is The Configuration File To Define Url Pattern And Its Controller And Action Name?

    grails-app/conf/UrlMappings.groovy.


  55. CSS Advanced Interview Questions

  56. 34. What Is Another Way To Make A Transaction Method That Not Use The Transactional Annotation In Grails?

    Using the “.withTransaction” method

    Example:

    Account.with Transaction { status ->

        def source = Account.get(params.from)

        def dest = Account.get(params.to)

        int amount = params.amount.to Integer()

        if (source.active) {

            source.balance -= amount

            if (dest.active) {

                dest.amount += amount

            }

            else {

                status.setRollbackOnly()

            }

        }

    }

  57. 35. How You Can Make A Method Not Transactional If The Whole Class Was Marked As Transactional?

    using the annotation @NotTransactional above the method’s name in the service

    Example:

    import grails.transaction.Transactional 

    @Transactional

    class BookService {

        @NotTransactional

        def listBooks() {

                     Book.list()

            }

        }

  58. 36. How You Can Made A Method Of A Service Be Transactional?

    With the annotation @Transactional above the method’s name of the service

    Example:

    import grails.transaction.Transactional

    class BookService

    @Transactional

        def updateBook()

    {

            // …

        }

    }


  59. Javascript Advanced Interview Questions

  60. 37. How Can You Made A All The Method Of A Service In Grails Be Transactional?

    With the annotation @Transactional above the class’s name

    Example:

    import grails.transaction.*

    @Transactional

    class Country Service {

    }

  61. 38. What Is The Use Of Flush Option In Save Operation Of A Domain?

    Saves the row immediately without any delay.

    Example 

    def book = new Book(title:”New Grails Book”)

    book.save(flush:true)

  62. 39. How You Can Create Many-to-many Relationship In Gorm?

    Many-to-many relationships in Grails can be specified by defining a has Many property on both sides and having a belongs To on the owned side:

    class Tag {

        static belongsTo = Post

        static hasMany = [posts: Post]

    }

    class Post {

        static hasMany = [tags: Tag]

    }

  63. 40. What Is A Grails Plugin?

    It’s a bundle/set of functionality to a desired propose that can be installed in your grails application.


  64. Restful web service Interview Questions

  65. 41. How Use Dynamic Scaffolding In Your App?

    in your controller:

    def scaffold=true  or def scaffold=”the name of your domain class”

  66. 42. How Render A Template In A View In Grails?

    use the tag:


  67. Groovy (programming language) Interview Questions

  68. 43. How Do You Inject A Service In Your Controller?

    def taskService

  69. 44. What Option Do You Use To Create War File For Specific Environment?

    Dgrails.env

    Example :
    grails -Dgrails.env=dev war