Thursday 13 February 2014

Configuring OpenXava with MySQL Database

Configuring OpenXava with MySQL Database:
------------------------------------------------
Install
1) MySQL database (ex. MySQL 5.5)
2) MySQL connector J (eg. mysql-connector-java-5.1.22-bin.jar)
3) OpenXava 4.9.1

Steps to follow :

1) Create a new project (ex. Academy) according to the steps mentioned in the OpenXava reference guide. (http://openxava.wikispaces.com/reference_en)

2) Go to MySQL DB Console and create a new database schema such as eg. academydb
also create a table using the following scrript
CREATE  TABLE IF NOT EXISTS `ACADEMYDB`.`ACADEMY` (
  `academyId` INT(3) NOT NULL ,
  `academyName` VARCHAR(25) NOT NULL,
  `city` VARCHAR(25),
  `state` VARCHAR(25),
  PRIMARY KEY (`academyId`) ,
  UNIQUE INDEX `ACADEMY_NAME_UNIQUE` (`academyName` ASC) );

3. Place MySQL connector jar into
{OpenXavaBase}/tomcat/lib
{OpenXavaBase}/workspace/OpenXavaTest/lib

4. Open the context.xml file in
{OpenXavaBase}/tomcat/conf folder.
Insert the following lines into the file.
<Resource name="jdbc/AcademyDS" auth="Container" type="javax.sql.DataSource"
                                maxActive="20" maxIdle="5" maxWait="10000"
                                username="root" password="root@123" driverClassName="com.mysql.jdbc.Driver"
                                url="jdbc:mysql://localhost:3306/academydb"/>

5. Go to the project folder’s build.xml (Academy/build.xml) and change updateSchema target as follows. You have to change the value of the schema.path to point to the MySQL connector jar which is available in OpenXavaTest/lib folder.
<target name="updateSchema">
                                <ant antfile="../OpenXava/build.xml" target="updateSchemaJPA">                                    
                                                <property name="persistence.unit" value="junit"/>
                                                <property name="schema.path" value="../OpenXavaTest/lib/mysql-connector-java-5.1.22-bin.jar"/>
                                </ant>
                </target>          

6.Go to persistence.xml (Academy/persistence/META-INF/persistence.xml)
Change the default persistence unit as follows
 <!-- Tomcat + MySQL-->
    <persistence-unit name="default">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <non-jta-data-source>java:comp/env/jdbc/AcademyDS</non-jta-data-source>
                <class>org.openxava.session.GalleryImage</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
        </properties>
    </persistence-unit>

<!-- JUnit MySQL-->
    <persistence-unit name="junit">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
                                <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
                                <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                                <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/academydb"/>
        </properties>
    </persistence-unit>  

7.Go to hibernate.cfg.xml (Academy/persistence/hibernate.cfg.xml) and change the hibernate.dialect to org.hibernate.dialect.MySQLDialect as follows
<!-- Tomcat + MySQL-->
                                <property name="hibernate.connection.datasource">java:comp/env/jdbc/AcademyDS</property>
                                <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
                                <property name="hibernate.jdbc.use_get_generated_keys">false</property>                            
                                <property name="hibernate.show_sql">false</property>

& now you run updateSchema target, it will create war & unzip it under webapps folder in
{OpenXavaBase}\tomcat\webapps\Academy, that will access the MySQL to retrieve and save data.

OpenXava RETAILDB DataModel MySQL DB Script

-- -----------------------------------------------------
-- Table RETAILDB.CUSTOMER
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.CUSTOMER (
  customerId INTEGER NOT NULL ,
  customerName VARCHAR(50) NOT NULL ,
  PRIMARY KEY (customerId) ,
  UNIQUE INDEX customerName_UNIQUE (customerName ASC) );

-- -----------------------------------------------------
-- Table RETAILDB.CATEGORY
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.CATEGORY (
  categoryCode VARCHAR(5) NOT NULL ,
  categoryName VARCHAR(50) NOT NULL ,
  PRIMARY KEY (categoryCode) ,
  UNIQUE INDEX categoryName_UNIQUE (categoryName ASC) );

-- -----------------------------------------------------
-- Table RETAILDB.PRODUCT
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.PRODUCT (
  productCode VARCHAR(10) NOT NULL ,
  productName VARCHAR(50) NOT NULL,
  description VARCHAR(100) ,  
  category_categoryCode VARCHAR(5) NOT NULL ,
  PRIMARY KEY (productCode) ,
  UNIQUE INDEX productName_UNIQUE (productName ASC),
 INDEX category_categoryCode_idx (category_categoryCode ASC) ,
CONSTRAINT category_categoryCode0
    FOREIGN KEY (category_categoryCode)
    REFERENCES RETAILDB.CATEGORY (categoryCode));
 

-- -----------------------------------------------------
-- Table RETAILDB.ITEM
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.ITEM (
  itemCode VARCHAR(10) NOT NULL ,
  itemName VARCHAR(50) NOT NULL,  
  unitPrice NUMERIC NOT NULL,
  product_productCode VARCHAR(10) NOT NULL ,
  PRIMARY KEY (itemCode) ,
  UNIQUE INDEX itemName_UNIQUE (itemName ASC),
 INDEX product_productCode_idx (product_productCode ASC) ,
CONSTRAINT product_productCode0
    FOREIGN KEY (product_productCode)
    REFERENCES RETAILDB.PRODUCT (productCode));

 
-- -----------------------------------------------------
-- Table RETAILDB.IMAGES
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.IMAGES (
  ID VARCHAR(255) NOT NULL ,
  GALLERY VARCHAR(255) ,
  IMAGE VARBINARY(255) ,
  PRIMARY KEY (ID));

-- -----------------------------------------------------
-- Table RETAILDB.INVOICE
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS RETAILDB.INVOICE (
  id VARCHAR(32) NOT NULL ,
  customer_customerId INTEGER NOT NULL ,
  invoiceNo INTEGER NOT NULL,
  year INTEGER,
  date TIMESTAMP,
  vatPercentage INTEGER,  
  remarks VARCHAR(255),
PRIMARY KEY (id) ,
UNIQUE INDEX invoiceNo_UNIQUE (invoiceNo ASC),
INDEX customer_customerId_idx (customer_customerId ASC) ,
CONSTRAINT customer_customerId0
    FOREIGN KEY (customer_customerId)
    REFERENCES RETAILDB.CUSTOMER (customerId ));

-- -----------------------------------------------------
-- Table RETAILDB.INVOICEDETAIL
-- -----------------------------------------------------
CREATE  TABLE IF NOT EXISTS RETAILDB.INVOICEDETAIL (
  id VARCHAR(32) NOT NULL ,
  invoice_id VARCHAR(32) NOT NULL,
  item_itemCode VARCHAR(10) NOT NULL ,
  quantity INTEGER NOT NULL,
PRIMARY KEY (id) ,
INDEX invoice_id_idx (invoice_id ASC) ,
CONSTRAINT invoice_id0
    FOREIGN KEY (invoice_id)
    REFERENCES RETAILDB.INVOICE (id ),
INDEX item_itemCode_idx (item_itemCode ASC) ,
CONSTRAINT item_itemCode0
    FOREIGN KEY (item_itemCode)
    REFERENCES RETAILDB.ITEM (itemCode));

-- -----------------------------------------------------
-- Table RETAILDB.XYZ
-- -----------------------------------------------------

Groovy/Grails Sample Questions and Answers Set II

Groovy/Grails Questions & Answers - 3.2 SET II:
-----------------------------------------------
1. What is the in-built database server which is used by grails apps?
A. H2 DB Server (ANSWER)
B. MySQL DB Server
C. PostgreSQL DB Server
D. Mongo DB Server (No SQL Database)
---------------------------------------------------------------------------------------------
2. In the given Open Source Framework, Which one is Apache's Web Framework?
A. Hibernate
B. Spring MVC
C. Struts (ANSWER)
D. Grails
---------------------------------------------------------------------------------------------
3. In the given Open Source Framework, Which one is not belongs to Web Framework?
A. Grails
B. Hibernate (ANSWER)
C. Struts
D. Rails
---------------------------------------------------------------------------------------------
4. In the given Web Framework, Which option is not the correct compination?
A. JRuby/Rails
B. Groovy/Grails
C. Scala/Play
D. JRuby/Grails (ANSWER)
---------------------------------------------------------------------------------------------
5. Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility. Which option is followed this concept?
A. Ruby on Rails
B. Groovy on Grails
C. All of the above (ANSWER)
D. None of the above
---------------------------------------------------------------------------------------------
6. In the given option, Which option is not belongs to MVC Framework?
A. Struts -2.3.12
B. JavaServer Faces - 2.1
C. Play -2.1.1
D. Google Web Toolkit(GWT) -2.5.1 (ANSWER)
---------------------------------------------------------------------------------------------
7. In the given option, Which option is not belongs to JavaScript Framework?
A. Ext JS-4.2
B. Google Web Toolkit-2.4 (ANSWER)
C. jQuery UI-1.9
D. DOJO-1.8
---------------------------------------------------------------------------------------------
8. Which file contains configuration properties and information needed when running your application?.
It contains properties used by your services, controllers, etc.
A. Config.groovy (ANSWER)
B. BootStrap.groovy
C. BuildConfig.groovy
D. DataSource.groovy
---------------------------------------------------------------------------------------------
9. Which file contains information relevant to building and deploying your application, such as repositories, jar file dependencies and war file name.?
A. Config.groovy
B. BuildConfig.groovy (ANSWER)
C. UrlMappings.groovy
D. DataSource.groovy
---------------------------------------------------------------------------------------------
10. Which file that allows you to define code that is ran every time your grails application starts up.?
A. BuildConfig.groovy
B. Config.groovy
C. UrlMappings.groovy
D. BootStrap.groovy (ANSWER)
---------------------------------------------------------------------------------------------
11. Explain about Grails shell:
A. Swing-based command console similar to the Groovy console. It will execute code against a full environment that has access to all your domain classes and quickly test out code that would go into controllers and services.

B. Interactive mode of the grails command line interface. It lets you run Gant scripts in the script runner one after another.

C. Headless version of Grails console.This is useful when you want to access and test out code in a remote SSH-based server.  It does not reload when domain classes change like the console does, so it is useful also for long-running scripts, although the new run-script command in Grails  (ANSWER)

D.  None of the above
---------------------------------------------------------------------------------------------
12. Which environments are available by default in Grails?
A. Development(dev), Test(test), Staging(stage) & Production(prod)
B. Production (prod), Staging (stage) & Development(dev)
C. Staging(prod), Test(test) & Development (dev)
D. Production(prod), Test(test) & Development(dev) (ANSWER)
---------------------------------------------------------------------------------------------
13. What is the difference between run-app and run-war?
A. run-war will compile and builds a war file that it runs from the embedded container ( Tomcat unless you’ve changed it ).
   run-app runs the application from compiled sources in the file system.
   This means that any change to controllers, views, etc will be reflected immediately by run-app, but not by run-war (ANSWER)
B. There are no difference between run-app and run-war.
C. run-app will compile and builds a war file that it runs from the embedded container ( Tomcat unless you’ve changed it ).
   run-war runs the application from compiled sources in the file system.
   This means that any change to controllers, views, etc will be reflected immediately by run-war, but not by run-app (ANSWER)
D. None of the above.
---------------------------------------------------------------------------------------------
14. "select distinct s.name from Student s" - This query of the domain objects belongs to
A. Dynamic finder
B. HSQL is a query language that looks like SQL but is fully object-oriented. (ANSWER)
C. Criterias are a DSL based on Hibernate Criterias and Groovy builders
D. None of the above.
---------------------------------------------------------------------------------------------
15. Student.findByName('Siddharth') added to domain classes - This query of the domain objects belongs to
A. Criterias are a DSL based on Hibernate Criterias and Groovy builders
B. Dynamic finder. (ANSWER)
C. HSQL is a query language that looks like SQL but is fully object-oriented.
D. All of the above.
---------------------------------------------------------------------------------------------
16. Gorm provides two auto-timestamping variables, what are they?
A. createdDateTime and updatedDateTime
B. createdDate & updatedDate
C. createdDateTS and updatedDateTS
D. dateCreated & lastUpdated (ANSWER)
---------------------------------------------------------------------------------------------
17. I have a property such as 'password' in my domain class that I don’t want to be persisted, how do I make sure it doesn’t generate a field in my database?
A. static transient = ['password'] (ANSWER)
B. static encrypt = ['password']
C. static String = ['password']
D. static volatile = ['password']
---------------------------------------------------------------------------------------------
18. In the given option, Which one is not belongs to programming language?
A. Java
B. Groovy
C. Scala
D. Javascript
---------------------------------------------------------------------------------------------

Thursday 4 July 2013

Groovy/Grails Sample Questions and Answers Set I

Groovy/Grails Questions & Answers - 4.1 SET I:
----------------------------------------------
1. The Grails Project uses to configure itself by
A. Convention over Configuration (ANSWER)
B. XML Based Configuration
C. applicationContext.xml
D. JSON Based Configuration
----------------------------------------------------------------------------------------------------
2. Which grails command to help to create a grails project?
A. create-project
B. create-application
C. create-grails-app
D. create-app (ANSWER)
----------------------------------------------------------------------------------------------------
3. Which following set of commands are not belongs to grails?
A. create-controller, generate-controller, generate-all
B. create-domain-class, create-service, generate-views
C. generate-domain-class, generate-service, create-views (ANSWER)
D. create-pom, create-unit-test, create-taglib
----------------------------------------------------------------------------------------------------
4. In GORM, Book and Author domains are having many-to-many relationships, then which domain notation is correct?
A. (ANSWER)
class Book {
String title
    static belongsTo = Author
    static hasMany = [authors:Author]  
}
class Author {
String name
    static hasMany = [books:Book]  
}
B.
class Book {
String title
    static belongsTo = Author    
}
class Author {
String name
    static hasMany = [books:Book]  
}
C
class Book {
String title  
    static hasMany = [authors:Author]  
}
class Author {
String name
static belongsTo = Book
}
D.
class Author {
String name
    static hasMany = [books:Book]  
}
class Book {
    String title
    static hasMany = [authors:Author]  
}
----------------------------------------------------------------------------------------------------
5. Grails supports both REST and SOAP based Web Services. To integrate SOAP into Grails which popular plugins allows you to expose
Grails services as SOAP services using a special expose property?
A. ZFire
B. WFire
C. XFire (ANSWER)
D. BFire
----------------------------------------------------------------------------------------------------
6. REST is extremely simple and just involves using plain XML or JSON as a communication medium, which combined with URL patterns that are "representational" of the underlying system and HTTP methods such as,
A. action = [REST-GET:"select", REST-PUT:"modify", REST-DELETE:"remove", REST-POST:"save"]
B. action = [GET:"show", PUT:"update", DELETE:"delete", POST:"save"] (ANSWER)
C. action = [HTTP-GET:"retrieve", HTTP-PUT:"amend", HTTP-DELETE:"remove", HTTP-POST:"save"]
D. action = [GET:"show", PUT:"update", REMOVE:"delete", CREATE:"save"]
----------------------------------------------------------------------------------------------------
7. Which set of exception is not belongs to GrailsException?
A. MissingMethodException, MissingPropertyException, RequiredPropertyMissingException
B. NullPointerException, IllegalArgumentException, IndexOutOfBoundsException (ANSWER)
C. GrailsConfigurationException, GrailsDomainException, GrailsRuntimeException
D. CompilationFailedException, InvalidPropertyException, GrailsDataSourceException
----------------------------------------------------------------------------------------------------
8. In Grails GORM is based on
A. Hibernate ORM based. (ANSWER)
B. Spring JDBC based.
C. iBatis DAO design based.
D. Toplink ORM based.
----------------------------------------------------------------------------------------------------
9. The Grails Services layer is by default built on
A. Spring Framework's AOP
B. Spring Security Framework
C. Spring Framework's Dependency Injection (ANSWER)
D. Spring Web 2.0 (MVC)
----------------------------------------------------------------------------------------------------
10. In GORM, User and Role domains are having many-to-one relationships, then which bi-directional domain notation is correct?
A.
class User {
String userName
    Role role
}
class Role {
String roleName  
}
B.
class User {
String userName    
}
class Role {
String roleName
    User user
}
C. (ANSWER)
class User {
String userName
static belongsTo = [role: Role]  
}
class Role {
String roleName
    static hasMany = [users:User]  
}
D.
class User {
String userName
static hasMany = [roles:Role]    
}
class Role {
String roleName
    static belongsTo = User
}
----------------------------------------------------------------------------------------------------
11. In GORM, MonitoringPoint and Application domains are having one-to-many relationships, then which uni-directional domain notation is correct?
A. (ANSWER)
class MonitoringPoint {
String monitoringPointName    
}
class Application {
String appName
MonitoringPoint monitoringPoint
}
B.
class MonitoringPoint {
String monitoringPointName
Application appplication
}
class Application {
String appName
MonitoringPoint monitoringPoint
}
C.
class MonitoringPoint {
String monitoringPointName
Application appplication
}
class Application {
String appName
}
D.
class MonitoringPoint {
String monitoringPointName
static hasMany = [apps:Application]
}
class Application {
String appName
static belongsTo = [monitoringPoint: MonitoringPoint]
}
----------------------------------------------------------------------------------------------------
12. Groovy is like a super version of Java. is it correct?
A. FALSE
B. TRUE (ANSWER)

----------------------------------------------------------------------------------------------------
13. Founder of Groovy / Grails (high-productivity framework) by
A. IBM
B. G2One (ANSWER)
C. SpringSource
D. VMware
----------------------------------------------------------------------------------------------------
14. A desktop framework inspired by Grails (Groovy on Rails)
A. Griffon Framework (ANSWER)
B. Play Framework
C. Spring Framework
D. Rails Framework

----------------------------------------------------------------------------------------------------
15. def list = ['Java', 'C#', 'Ruby', 'Groovy', 'Scala']
assert list.get(2) == ?
A. C#
B. Ruby (ANSWER)
C. Groovy
D. Scala
----------------------------------------------------------------------------------------------------
16. list= ['a', 'e', 'i', 'o', 'u', 'z']
use(Collections){ list.swap(2, 4) } //or: Collections.swap(list, 2, 4)
assert list == ?
A. ['a', 'e', 'u', 'o', 'i', 'z'] (ANSWER)
B. ['a', 'o', 'u', 'e', 'i', 'z']
C. ['a', 'e', 'u', 'o', 'i', 'a']
D. ['a', 'e', 'i', 'o', 'u', 'z']
------------------------------------------------------------------------------------------------------
17. def singList= Collections.singletonList('a')
assert singList == ['a']
try{
singList<< 'b';
assert 0
}
catch(e){
assert e instanceof UnsupportedOperationException
}
-- what is the result ?

A. singList == ['a']
B. singList == ['b']
C. single-element list that can't be modified. (ANSWER)
D. 0
---------------------------------------------------------------------------------------------------------
18. def set= Collections.emptySet()
assert set == [] as Set
try{
set<< 'a';
assert 0
}
catch(e){
assert e instanceof UnsupportedOperationException
}
-- what is the result ?
A. set == ['a']
B. set == []
C. 0
D. UnsupportedOperationException. (ANSWER)
--------------------------------------------------------------------------------------------------------
19. Grails-2.2.1 and Grails-2.1.1 compatible Groovy Compiler version is
A. Groovy-2.0.7 and Groovy-1.8.6 (ANS)
B. Groovy-2.1 and Groovy-2.0
C. Groovy-2.1 and Groovy-1.8
D. Groovy-2.1 and Groovy-1.7
--------------------------------------------------------------------------------------------------------
20. Which Integrated Development Environment (IDE) is introduced by VMWare to develop Grails Apps?
A. Eclipse JUNO - 4.2
B. IntelliJ IDEA
C. Groovy/Grails Tool Suite (GGTS-3.x) (ANSWER)
D. Rational Application Development (RAD-7.x)
--------------------------------------------------------------------------------------------------------
21. How do I declare and initialize a traditional array at Groovy?
A. String[] x = [ "a", "qrs" ]
B. String[] x = [ "a", "qrs" ] as String[]
C. def x = [ "a", "qrs" ] as String[]
D. All the above. (ANSWER)
--------------------------------------------------------------------------------------------------------
22. To send an error / exception message back to Groovy Server Page(s) from controller
A. flash.message (ANSWER)
B. flash.error
C. flash.exception
D. message.error
--------------------------------------------------------------------------------------------------------
23. As per Grails-2.2.1, Scaffolding feature does not currently support many-to-many relationship and hence you must write the code to manage the relationship yourself. Is this statement is true or false?
A. TRUE (ANSWER)
B. FALSE
--------------------------------------------------------------------------------------------------------
24. If you execute the following grails command from cmd prompt, The result will be a class at
grails create-domain-class com.wipro.bookstore.Book
A. grails-app/domainclasses/com/wipro/bookstore/Book.class
B. grails-app/domains/com/wipro/bookstore/Book.groovy
C. grails-app/domain/com/wipro/bookstore/Book.groovy (ANSWER)
D. grails-app/domain-class/com/wipro/bookstore/Book.class
--------------------------------------------------------------------------------------------------------
25.If you execute the following grails command from cmd prompt, The result will be a class at
grails create-service com.wipro.bookstore.Book
A. grails-app/services/com/wipro/bookstore/BookService.groovy (ANSWER)
B. grails-app/service/com/wipro/bookstore/BookService.groovy
C. grails-app/services/com/wipro/bookstore/BookService.class
D. grails-app/services/com/wipro/bookstore/Book.groovy
--------------------------------------------------------------------------------------------------------
26.If you execute the following grails command from cmd prompt, The result will be a class at
grails create-controller com.wipro.bookstore.Book
A. grails-app/controller/com/wipro/bookstore/BookController.groovy
B. grails-app/controllers/com/wipro/bookstore/BookController.groovy (ANSWER)
C. grails-app/controllers/com/wipro/bookstore/Book.class
D. grails-app/controllers/com/wipro/bookstore/BookController.class
--------------------------------------------------------------------------------------------------------
27. At the User domain class, To validate username, password String value is not blank, what we have to do at that domain class?
A.
username (blank:true)
password (blank:true)

B.
username (nullable: true)
password (nullable: true)

C.
username (nullable: false)
password (nullable: false)

D. (ANSWER)
username (blank:false)
password (blank:false)
--------------------------------------------------------------------------------------------------------
28. In the Employee domain class, To validate his email_personal & credit_card_number, website_url String value is a valid email address & credit card number, URL, what we have to do at that domain class?
A. (ANSWER)
email_personal (email:true)
credit_card_number (creditCard:true)
website_url (url:true)
B.
email_personal (email:false)
credit_card_number (creditCard:false)
website_url (url:false)
C.
email_personal (blank:false)
credit_card_number (blank:false)
website_url (blank:false)
D.
email_personal (nullable:false)
credit_card_number (nullable:false)
website_url (nullable:false)
--------------------------------------------------------------------------------------------------------
29. In Grails, The Controller by default calls index() action.  Allows you to explicitly specify the default action is "list" that should be executed if no action is specified in the URI. Please choose which one is the correct?
A. void defaultAction = "list"
B. def defaultAction = "list"
C. static defaultAction = "list" (ANSWER)
D. private defaultAction = "list"
--------------------------------------------------------------------------------------------------------
30. Which command will be used to start and stop the server of Grails App?
A. start-app & stop-app
B. run-app & stop-app (ANSWER)
C. app-run & app-stop
D. app-start & app-stop
---------------------------------------------------------------------------------------------------------
31. Grails environment has integrated by default with Tomcat server.Default port number is 8080.
To change this port into 9090 we need to add the following lines at which conf file?
grails.server.port.http = 9090
grails.server.port.https = 9090

A. Config.groovy
B. BootStrap.groovy
C. BuildConfig.groovy (ANSWER)
D. DataSource.groovy
--------------------------------------------------------------------------------------------------------
32. To add grails app's runtime dependencies and plugins, which conf file we need to use?
A. BuildConfig.groovy (ANSWER)
B. BootStrap.groovy
C. Config.groovy
D. DataSource.groovy
--------------------------------------------------------------------------------------------------------
33.To use log4j at a grails app, which conf file we need to add log4j configuration?
A. BuildConfig.groovy
B. Config.groovy (ANSWER)
C. BootStrap.groovy
D. UrlMappings.groovy
--------------------------------------------------------------------------------------------------------
34. In Grails, Which conf file we need to use to hold database setup configuration?
A. BuildConfig.groovy
B. Config.groovy
C. BootStrap.groovy
D. DataSource.groovy (ANSWER)
--------------------------------------------------------------------------------------------------------
35. In Grails, Under which grails-app folder we need to add our customized <ProjectName>Filters.groovy file configuration?
A. taglib
B. i18n
C. utils
D. conf (ANSWER)
--------------------------------------------------------------------------------------------------------
36. In Grails, To create a database tables from groovy domain classes, what environment specific settings we have to do?
 A.
 environments {
development {
dataSource {
dbCreate = "update"
}
}
 }
 B. (ANSWER)
  environments {
development {
dataSource {
dbCreate = "create"
}
}
 }
 C.
  environments {
development {
dataSource {
dbCreate = "insert"
}
}
 }
 D.
  environments {
development {
dataSource {
dbCreate = "save"
}
}
 }
--------------------------------------------------------------------------------------------------------
37. Create a Web Application Archive (WAR) file from the Grails project, which can be deployed on any Java EE compliant application server, what grails command need to use?
A. grails war (ANSWER)
B. grails create-war
C. grails generate-war
D. grails app-war
--------------------------------------------------------------------------------------------------------
38. The GrailsApplication class provides information about the conventions within Grails and access to metadata, config and the ClassLoader.
A. FALSE
B. TRUE (ANSWER)
--------------------------------------------------------------------------------------------------------
39. Which one is correct to auto generate id for MONITORING_POINT table?
A.
static mapping = {
table 'MONITORING_POINT'
id generator: 'identity', params: [identity: 'monitoringPointId'], column: 'MONITORING_POINT_ID'
}
B.
static mapping = {
table 'MONITORING_POINT'
id generator: 'sequence', params: [sequence: 'monitoringPointId'], column: 'MONITORING_POINT_ID'
}
C. All of the above (ANSWER)
D. None of the above
--------------------------------------------------------------------------------------------------------
40. Generates a controller, views, and a controller unit test for the given domain class which command you need to run?
A. grails generate-all
B. grails generate-all "*"
C. grails generate-all com.wipro.bookstore.Book (ANSWER)
D. All of the above
--------------------------------------------------------------------------------------------------------