In: Computer Science
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
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:
java.sql.Date
)java.sql.Time
)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:
java.sql.Date
)java.sql.Time
)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.