Docsity

Guidewire Query API-----------Guidewire Query API, Exams of Advanced Education

Toggle sidebar
bg1
Guidewire Query API
How do you use the Query API to create a reference to a table called ABPerson? -
correct answer var query = gw.api.database.Query.make(ABPerson)
Say you have a variable called "query" that is a query object for a table called
ABPerson. How do you use the Query API to compare the Nickname column of the
ABPerson table to the value of "Will"? - correct answer First, you would do the
comparison. Then, you would call "select()" to get the results of the comparison.
query. compareIgnoreCase (ABPerson#Nickname, Relop.Equals, "Will")
var results Obj = query. Select()
Why was the Property Reference class introduced into the Query API? - correct
answer Previously the property would be specified as a string, which meant it could
be a string for a table that doesn't exist in the db. In that case, the compiler would
not catch the error.
What is the syntax for specifying a property reference? - correct answer
EntityType#Property
Why should you exercise caution when using contains()? - correct answer It can
negatively affect performance when the queried data set is very large.
How should you improve the performance of a query when you need to use the
contains() predicate? - correct answer Filter out the dataset using compare()
predicates and only execute contains() on a smaller subset of data. For example, if
you needed to get all Users with a last name of "Williams," you will have to use
contains() to check the last name property. Instead of doing it on ALL Users in the
database, you might filter out all inactive users first using the compare() predicate
on the active property. Basically, find a way to make this dataset smaller using
compare operations.
pf3
pf4
pf5

Partial preview of the text

Download Guidewire Query API-----------Guidewire Query API and more Exams Advanced Education in PDF only on Docsity!

Guidewire Query API

How do you use the Query API to create a reference to a table called ABPerson? - correct answer var query = gw.api.database.Query.make(ABPerson) Say you have a variable called "query" that is a query object for a table called ABPerson. How do you use the Query API to compare the Nickname column of the ABPerson table to the value of "Will"? - correct answer First, you would do the comparison. Then, you would call "select()" to get the results of the comparison. query. compareIgnoreCase (ABPerson#Nickname, Relop.Equals, "Will") var results Obj = query. Select() Why was the Property Reference class introduced into the Query API? - correct answer Previously the property would be specified as a string, which meant it could be a string for a table that doesn't exist in the db. In that case, the compiler would not catch the error. What is the syntax for specifying a property reference? - correct answer EntityType#Property Why should you exercise caution when using contains()? - correct answer It can negatively affect performance when the queried data set is very large. How should you improve the performance of a query when you need to use the contains() predicate? - correct answer Filter out the dataset using compare() predicates and only execute contains() on a smaller subset of data. For example, if you needed to get all Users with a last name of "Williams," you will have to use contains() to check the last name property. Instead of doing it on ALL Users in the database, you might filter out all inactive users first using the compare() predicate on the active property. Basically, find a way to make this dataset smaller using compare operations.

How can you improve the performance of an endsWith() search that you need to execute frequently on a large dataset? - correct answer Denormalize the database by adding a new column to the table in question that stores the value you are searching in reverse. Then, you can use startsWith() instead of endsWith(), which performs much better even on the entire dataset without filtering anything out. What must you be sure to do if you add a new column to a database storing a different column's value in reverse? - correct answer Write a rule to keep the denormalized column in sync. Also, ensure that the reverse value is correctly applied to all previous columns. What is the method you can use to search for a column value when not knowing what case its in? - correct answer compareIgnoreCase What property must be set to true on an entity column for it to be searchable via the compareIgnoreCase method? - correct answer supportsLinguisticSearch What happens when you set the supportsLinguisticSearch attribute to true on a column? - correct answer The application creates a denormalized version of the column for case-insensitive searches. This denormalized version is just the column's value in all lower case. What kind of column cannot be used with supportsLinguisticSearch? - correct answer An encrypted column. If a column value is known to be always upper case, what can you do when searching? - correct answer Use the .toUpperCase() method on the variable. A subselect is used to eliminate what? - correct answer duplicate rows What does the CompareIn method for a subselect do? - correct answer Filters the outer query by results found in the inner query. What does the CompareNotIn method for a subselect do? - correct answer Filters the outer query by all results NOT found in the inner query.

database into memory which are not needed if you are only checking the existence of something. Why should you not test the Empty property before running a select on a query to return the FirstResult? - correct answer The FirstResult will return null if the resulting data is empty--there is no need to check the Empty property. Why should you avoid iteration over entities from the database to count? - correct answer The database will always be more performant at counting--remember the golden rule: bring back only what you actually need. Why should you avoid queries to find new or changed entities? - correct answer Queries to test for new or changed entities retrieve many irrelevant entities. What methods should be used to access changed items on an entity? - correct answer getChangedFields getAddedArrayElements getChangedArrayElements getRemovedArrayElements Give an example of a specialized method that tests for a new or changed entity? - correct answer Claim.PolicyChanged What Boolean methods can be used to determine if entities have changes? - correct answer isFieldChanged isArrayElementAddedOrRemoved isArrayElementChanged When should you use a row query instead of an entity query? - correct answer If the performance of the entity query is inadequate. Entity queries sometimes fetch unused data columns or execute additional queries in code that processes the results.

When should you use a row query? - correct answer When you want to apply a database aggregate function to a column like Avg, Count, Min, Max, and Sum. The code for entity queries is better than row queries in what way? - correct answer More readable and maintainable than row queries. A row query has what table alias? - correct answer qRoot A Gosu Query API query has what table alias? - correct answer gRoot A Key Load can have what two table aliases? - correct answer qRoot/gRoot A bean query has what table alias? - correct answer bRoot A bean query has what table alias? - correct answer bRoot