Question

In: Computer Science

Question 1 The annotation that is used to identify the primary key attribute of a class....

Question 1

The annotation that is used to identify the primary key attribute of a class.

Group of answer choices

Id

Column

Entity

OneToMany

Question 2

The entity manager method that selects a row from a table given a primary key.

Group of answer choices

getEntity

close

find

persist

Question 3

The annotation that is used to identify the tale that the class is mapped to.

Group of answer choices

Temporal

Id

Table

Entity

Question 4

The annotation that specifies the field in a table that the attribute is mapped to.

Group of answer choices

Column

Id

Entity

OnToMany

Flag this Question

Question 5

The annotation that specifies that a Java class is to be mapped to a table

Group of answer choices

Temporal

Id

Entity

Column

Solutions

Expert Solution

Question 1:

Answer:

The annotation that is used to identify the primary key attribute of a class is Id.

Explanation:

@Id - Each class will have a primary key, which you annotate on the class with the @Id annotation.

@Column - The @Column annotation is used to specify the details of the column to which a field or property will be mapped.

@Entity - The @Entity annotation marks a class as an entity bean, so it must have a no-argument constructor that is visible with at least protected scope.

@OneToMany - Uses one to many mapping to create 1..N relationship between entities or objects.

Question 2:

Answer:

The entity manager method that selects a row from a table given a primary key is find.

Explanation:

getEntity - There are three methods for getEntity : a)getEntityManagerFactory, b)getEntityGraph, c)getEntityGraphs.

close - Close an application-managed entity manager.

find - Find by primary key. Search for an entity of the specified class and primary key. If the entity instance is contained in the persistence context, it is returned from there.

persist - Make an instance managed and persistent.

Question 3:

Answer:

The annotation that is used to identify the table that the class is mapped to is Table.

Explanation:

@Temporal - @Temporal annotationis used to store in the database table on of the following column items:

  1. DATE (java.sql.Date)
  2. TIME (java.sql.Time)
  3. TIMESTAMP (java.sql.Timestamp)

@Id - Each class will have a primary key, which you annotate on the class with the @Id annotation.

@Table - The @Table annotation allows to specify the details of the table that that the class is mapped to.

@Entity - The @Entity annotation marks a class as an entity bean, so it must have a no-argument constructor that is visible with at least protected scope.

Question 4:

Answer:

The annotation that specifies the field in a table that the attribute is mapped to is Column.

Explanation:

@Column - The @Column annotation is used to specify the details of the column to which a field or property will be mapped.

@Id - Each class will have a primary key, which you annotate on the class with the @Id annotation.

@Entity - The @Entity annotation marks a class as an entity bean, so it must have a no-argument constructor that is visible with at least protected scope.

@OneToMany - Uses one to many mapping to create 1..N relationship between entities or objects.

Question 5:

Answer:

The annotation that specifies that a Java class is to be mapped to a table is Entity.

Explanation:

@Temporal - @Temporal annotationis used to store in the database table on of the following column items:

  1. DATE (java.sql.Date)
  2. TIME (java.sql.Time)
  3. TIMESTAMP (java.sql.Timestamp)

@Id - Each class will have a primary key, which you annotate on the class with the @Id annotation.

@Entity - The @Entity annotation marks a class as an entity bean, so it must have a no-argument constructor that is visible with at least protected scope.

@Column - The @Column annotation is used to specify the details of the column to which a field or property will be mapped.


Related Solutions

Identify every possible primary key, candidate key, and foreign key for the following relations. Separate each...
Identify every possible primary key, candidate key, and foreign key for the following relations. Separate each key using a semicolon to avoid confusion. Assumptions: MIScompany has branches located in several states within the United States. A customer can be an individual or organization. driverId is the driving license number, ssno is the social security number and upc is the universal product code. Any equipment is rented and returned at the same branch. A customer can be a manufacturer and vice...
When viewed from the highest to most elemental level, the data hierarchy is a. attribute, record, file. b. record, attribute, key. c. file, record, attribute. d. file, record, key. e. key, record, file.
When viewed from the highest to most elemental level, the data hierarchy is a. attribute, record, file. b. record, attribute, key. c. file, record, attribute. d. file, record, key. e. key, record, file. 
the mysql lyrics database is provided below 1.)What is a primary key used for? Can you...
the mysql lyrics database is provided below 1.)What is a primary key used for? Can you give me an example of a primary key in the Lyrics database? 2.)What is the purpose of doing a join between two tables. Ex. Why would I ever want to join the Tracks and Titles tables together? 3.)Why is isolation important in database design? DROP TABLES IF EXISTS Artists,Genre, Members, Titles, Tracks,SalesPeople,Studios,XrefArtistsMembers; DROP TABLES IF EXISTS Authors,Publishers,Titles,Title_Authors,Royalties; DROP TABLES IF EXISTS Products,Customers,Orders,Order_details; DROP TABLES...
All records in a file must be uniquely identifiable in at least one attribute, which is its primary key. Drawing on your general knowledge of accounting,
All records in a file must be uniquely identifiable in  at least one attribute, which is its primary key.  Drawing on your general knowledge of accounting,  identify the primary key for the following types of  accounting records. To illustrate, the first record is  done for you.Accounts Receivable Accounts Payable Inventory Customer Sales Orders Purchase Orders to vendors Cash Receipts (checks) from Customers Cash Disbursements (checks) to vendors Employee Payroll Earnings Records
Evaluation and Management Key Components Understanding the three key components that are used to properly identify...
Evaluation and Management Key Components Understanding the three key components that are used to properly identify the correct E/M level of service is essential for you to know as a medical coder. Reimbursement and compliance are closely tied to our accurate knowledge and expertise and these are the main elements of the job! For this discussion, consider your three key components: history, examination, medical decision making as you respond to each prompt. Apply your knowledge by including key component decision...
Questions: Question-1: Identify key international trade and finance principles in the case. Question-2: What are the...
Questions: Question-1: Identify key international trade and finance principles in the case. Question-2: What are the financial instruments used to facilitate foreign trade? Question-3: What are the typical foreign trade transactions involved in the case? Financing the foreign trade: the case of an India textile exporter Namita Rajput, Rohit Bhagat and Saachi Bhutani Bhagat Namita Rajput is Associate Professor at University of Delhi, New Delhi, India. Rohit Bhagat is Manager at Yes Bank Ltd, New Delhi, India. Saachi Bhutani Bhagat...
Database Problem description:1. What is the difference between a candidate key and the primary key for...
Database Problem description:1. What is the difference between a candidate key and the primary key for a given relation? What is a superkey? 2. What is a foreign key constraint? Why are such constraints important? What is referential integrity? 3. Answer teach of the following questions. The questions are based on the following relational schema:Emp(eid: integer, ename: string, age: integer, salary: real)Works(eid: integer, did: integer, pct_time: integer)Dept(did: integer, dname: string, budget: real, managerid: integer) (1) Write the SQL statements required...
A key role of penetration testing as used by IT security professionals is to identify system...
A key role of penetration testing as used by IT security professionals is to identify system weaknesses of various kinds. According, pen testing is an important method for protecting organizations from unwanted attacks or intrusions. Why is it important to understand the risks presented by weak physical security? How does defense in depth prevent attacks? What considerations inform decisions regarding which physical controls should be implemented and for what reasons?
HashMap is a Map based collection class that is used for storing Key & value pairs,...
HashMap is a Map based collection class that is used for storing Key & value pairs, it is denoted as HashMap<Key, Value> or HashMap<K, V>. This class makes no guarantees as to the order of the map. It is similar to the Hashtable class except that it is unsynchronized and permits nulls(null values and null key). 5.Write a Java program to test if a map contains a mapping for the specified key.a.Add values in the Hash mapb.Printthe mapc.Check for a...
what is super key,  candidate key, and primary key, and foreign key in terms of database? and...
what is super key,  candidate key, and primary key, and foreign key in terms of database? and plz provide some examples, thanks.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT