• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

My exam cloud mock exam 1 : Bulk delete data that does not exist

Ranch Foreman
Posts: 1897
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A Gift entity is in a one-to-many relationship with a Product entity. An EJB developer writes a query to delete gifts
that have an item of "JPA" or  "JSF" and writes the following Java Persistence query language statement.
DELETE FROM Gift g WHERE g.name IN ("JPA", "JSF")/
If the query with a PersistenceException, what can be the cause?
B. The query causes a foreign key integrity constraint to be violated.
C. The database does not have any users with the name "JPA" or "JSF".
Correct answer :B

Should C be the answer as well?
The specification 4.10 does not say whether the persistence provider will throw an exception if a record does not exist when DELETE is executed.
Creator of Enthuware JWS+ V6
Posts: 3341
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Should C be the answer as well?

No, that does not cause the transaction to fail.

Note that: if the OneToMany relationship is an unidirectional relationship between Gift and Product there will be a JoinTable inbetween. Running the given delete query in that setup won't cause an exception to be thrown.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic