This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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

Ranch Hand
Posts: 1742
  • 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.
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: 3289
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!