This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How You Can Make A Method Not Transactional If The Whole Class Was Marked As Transactional? |
|
Answer» using the ANNOTATION @NotTransactional above the method's NAME in the service IMPORT grails.transaction.Transactional @Transactional using the annotation @NotTransactional above the method's name in the service Example: import grails.transaction.Transactional @Transactional |
|
| 2. |
How You Can Made A Method Of A Service Be Transactional? |
|
Answer» With the anotation @TRANSACTIONAL above the method's name of the SERVICE import grails.transaction.Transactional class BookService { With the anotation @Transactional above the method's name of the service Example: import grails.transaction.Transactional class BookService { |
|
| 3. |
How Can You Made A All The Method Of A Service In Grails Be Transactional? |
|
Answer» with the anotation @TRANSACTIONAL above the CLASS's NAME IMPORT grails.transaction.* with the anotation @Transactional above the class's name Example: import grails.transaction.* |
|
| 4. |
How Can You Install A Pluguin In Your Grails Application? |
|
Answer» you have to write your pluguin inside the pluguins Block/closure {} in the BuildConfig.groovy FILE and you have to specify if your pluguin works at RUN TIME or compilation time. Example: plugins { you have to write your pluguin inside the pluguins Block/closure {} in the BuildConfig.groovy file and you have to specify if your pluguin works at run time or compilation time. Example: plugins { |
|
| 5. |
What Is The Use Of Flush Option In Save Operation Of A Domain? |
|
Answer» SAVES the row immediately without any delay. Example DEF BOOK = new Book(title:"New GRAILS Book") Saves the row immediately without any delay. Example def book = new Book(title:"New Grails Book") |
|
| 6. |
How You Can Create Many-to-many Relationship In Gorm? |
|
Answer» Many-to-many RELATIONSHIPS in Grails can be specified by DEFINING a hasMany property on both sides and having a belongsTo on the owned side: CLASS TAG { Many-to-many relationships in Grails can be specified by defining a hasMany property on both sides and having a belongsTo on the owned side: class Tag { |
|
| 7. |
How You Can Create One-to-one Relationship In Gorm? |
|
Answer» There are two ways of specifying a one-to-one relationship: FIRST Add an article PROPERTY and the unique constraint to the User domain: class User { There are two ways of specifying a one-to-one relationship: First Add an article property and the unique constraint to the User domain: class User { |
|
| 8. |
How You Can Create A Bidirectional Relationships In Gorm? |
|
Answer» using: static belongsTo = USER CLASS User { using: static belongsTo = User example: class User { |
|
| 9. |
How You Can Create A One-to-many Relationship In Gorm? |
|
Answer» you can use STATIC hasMany property at the "ONE" SIDE: CLASS User { you can use static hasMany property at the "one" side: class User { |
|
| 10. |
What Annotation Is Used For Unit Testing Of Grails Controller? |
|
Answer» grails.test.mixin.TestFor grails.test.mixin.TestFor |
|
| 11. |
What Is New Scope Available In The Grails Services Which Makes Sure That A New Service Will Be Created For The Current And Next Request Only? |
|
Answer» Flash Flash |
|
| 12. |
What Happens With The Db If You Have 'nothing/null' In The Option "dbcreate" Of Your Data Source? |
|
Answer» Does NOTHING with your DATA BASE Does nothing with your data base |
|
| 13. |
What Happens With The Db If You Have 'validate' In The Option "dbcreate" Of Your Data Source? |
|
Answer» Makes no CHANGES to your database. Compares the CONFIGURATION with the existing database schema and reports WARNINGS. Makes no changes to your database. Compares the configuration with the existing database schema and reports warnings. |
|
| 14. |
What Happens With The Db If You Have 'update' In The Option "dbcreate" Of Your Data Source? |
|
Answer» Creates missing TABLES and indexes, and updates the current schema without dropping any tables or data. Note that this can't properly handle many schema changes like column renames (you're LEFT with the OLD column containing the existing data). Creates missing tables and indexes, and updates the current schema without dropping any tables or data. Note that this can't properly handle many schema changes like column renames (you're left with the old column containing the existing data). |
|
| 15. |
What Happens With The Db If You Have 'create-drop' In The Option "dbcreate" Of Your Data Source? |
|
Answer» Same as CREATE, but ALSO drops the TABLES when the application SHUTS down cleanly. Same as create, but also drops the tables when the application shuts down cleanly. |
|
| 16. |
What Happens With The Db If You Have 'create' In The Option "dbcreate" Of Your Data Source? |
|
Answer» DROPS the existing schemaCreates the SCHEMA on startup, DROPPING existing TABLES, indexes, etc. first. Drops the existing schemaCreates the schema on startup, dropping existing tables, indexes, etc. first. |
|
| 17. |
What Are The Differents Options To "dbcreate" Inside A Data Source Of An Environment? |
|
Answer» 'CREATE', 'create-drop', 'update', 'validate' and ' NULL ' 'create', 'create-drop', 'update', 'validate' and ' null ' |
|
| 18. |
How You Can Use A Namespace Different Than "g: " To Render Your Tag Library In Your Views? |
|
Answer» USING the line in your TAG library: static namespace = "your CUSTOM namespace" using the line in your tag library: static namespace = "your custom namespace" |
|
| 19. |
What Is The Command To Run Your App In A Custom Environment? |
|
Answer» GRAILS -Dgrails.env="your CUSTOM ENVIROMENT" run-app grails -Dgrails.env="your custom enviroment" run-app |
|
| 20. |
How You Can Have Control Over The Way Grails Mapping The Urls In Your Application? |
|
Answer» In "conf/UrlMappings.groovy" you can CUSTOMIZE how GRAILS MAPS the URLS in your APPLICATION In "conf/UrlMappings.groovy" you can customize how grails maps the URLs in your application |
|
| 21. |
How You Can Validate Your Domain Classes Against Invalid Data? |
|
Answer» USING : STATIC CONSTRAINTS{ } using : static constraints{ } |
|
| 23. |
How You Can Map Directly A Property Of A Domain Class To An Specific Column In Table Of Your Db? |
|
Answer» CLASS Person { class Person { |
|
| 24. |
How You Can Map Directly A Domain Class To An Specific Table In Your Db? |
|
Answer»
class PERSON { in your domain class: class Person { |
|
| 25. |
What Is The Difference Between User.findbyname() And User.findallbyname() In The Dynamic Finders? |
|
Answer» That Findbyname RETURN The FIRST RESULT And Findallbyname Return A LIST With All The RESULTS That Findbyname Return The First Result And Findallbyname Return A List With All The Results |
|
| 27. |
How You Can Use A Tag Library In Your View? |
|
Answer» <g:"your TAG library name" /> <g:"your tag library name" /> |
|
| 28. |
What Is A Grails Pluguin? |
|
Answer» It's a bundle/set of FUNCTIONALITY to a desired PROPOSE that can be INSTALLED in your grails APPLICATION. It's a bundle/set of functionality to a desired propose that can be installed in your grails application. |
|
| 29. |
What Is A Template In Grails? |
|
Answer» It's a REUSABLE PART of a VIEW that can be USED to RENDER a small part of a view. It's a reusable part of a view that can be used to render a small part of a view. |
|
| 30. |
How Use Dynamic Scaffolding In Your App? |
|
Answer» in your CONTROLLER: def SCAFFOLD=true or def scaffold="the NAME of your domain class" in your controller: def scaffold=true or def scaffold="the name of your domain class" |
|
| 31. |
How You Can Load Preload Data When Startup Your Aplication? |
|
Answer» USING Boostrap.groovy using Boostrap.groovy |
|
| 32. |
How Render A Template In A View In Grails? |
|
Answer» USE the tag: use the tag: |
|
| 33. |
How Do You Inject A Service In Your Controller? |
|
Answer» DEF taskService def taskService |
|
| 34. |
What Is Are The Closures In Groovy? |
|
Answer» A closure in Groovy is an open, ANONYMOUS, block of code that can take arguments, return a VALUE and be ASSIGNED to a variable. A closure in Groovy is an open, anonymous, block of code that can take arguments, return a value and be assigned to a variable. |
|
| 35. |
What Is The Command To Create A Tag Library In Grails? |
|
Answer» GRAILS create-tag-library+ "packpage"+"NAME" grails create-tag-library+ "packpage"+"name" |
|
| 36. |
What Is The Command To Create A Service In Grails? |
|
Answer» GRAILS create-SERVICE "packpage"+"service NAME" grails create-service "packpage"+"service name" |
|
| 37. |
By Default Services In Grail Is Singleton Or Prototype? |
|
Answer» Singleton. Singleton. |
|
| 38. |
What Option Do You Use To Create War File For Specific Environment? |
|
Answer» -Dgrails.env EXAMPLE : GRAILS -Dgrails.env=dev WAR -Dgrails.env Example : grails -Dgrails.env=dev war |
|
| 39. |
What Is Command To Refresh Dependencies? |
|
Answer» GRAILS refresh-dependencies grails refresh-dependencies |
|
| 40. |
What Is The Name Of Config File To Define Database Connection Properties? |
|
Answer» grails-app/conf/DataSource.groovy. grails-app/conf/DataSource.groovy. |
|
| 41. |
What Is Javascript Tag In Gsp? |
|
Answer» INCLUDES JavaScript LIBRARIES and SCRIPTS as well as PROVIDING a shorthand for inline JavaScript. Includes JavaScript libraries and scripts as well as providing a shorthand for inline JavaScript. |
|
| 42. |
How Do You Access Servlet Attributes From Controller? |
|
Answer» servletContext servletContext |
|
| 43. |
How Do You Render A Domain Object As Xml Or Json? |
|
Answer» RENDER Book.list(OBJECT) as JSON render Book.list(object) as JSON |
|
| 44. |
How Can I Turn On Logging For Hibernate In Order To See Sql Statements, Input Parameters And Output Results? |
|
Answer» EDIT your Config.groovy file. FIND the line with: HIBERNATE = "off" Edit your Config.groovy file. Find the line with: hibernate = "off" |
|
| 46. |
What Is The Configuration File To Define Url Pattern And Its Controller And Action Name? |
|
Answer» grails-app/conf/UrlMappings.groovy. grails-app/conf/UrlMappings.groovy. |
|
| 47. |
How Do You Configuring Eager Fetching In A Domain Class? |
|
Answer» using: Example: CLASS AIRPORT { using: lazy: false Example: class Airport { |
|
| 48. |
Associations In Gorm Are By Default Lazy Or Eager? |
|
Answer» lazy lazy |
|
| 49. |
What Is Dynamic Finders? |
|
Answer» Are the methods auto GENERATED by grails based on fields of the domain class. Example. class Book { String title Are the methods auto generated by grails based on fields of the domain class. Example. class Book { String title |
|
| 50. |
What Method Do You Use To Check If Any Field Of An Object Has Been Modified? |
|
Answer» isDirty getDirtyPropertyNames : to GET NAMES of MODIFIED FIELDS. isDirty getDirtyPropertyNames : to get names of modified fields. |
|