• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

EntityExistsException

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In persistance spec 3.7:
"
The EntityExistsException may thrown by the persistenc
operation is invoked and the entity already exists. The E
thrown when the persist operation is invoked, or the Enti
PersistenceException may be thrown at commit time. "

But in the study guide:
"
For a given entity A, the persist method behaves as follows:

If A is an existing MANAGED entity, it is IGNORED. However, the persist operation
cascades as defined below. "

Isn't the two contradictory? If one invokes persist(A) where A is a managed entity and surely already exists, will this persist() be ignored or an EntityExistsException be thrown?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

"
The EntityExistsException may thrown by the persistenc
operation is invoked and the entity already exists. The E
thrown when the persist operation is invoked, or the Enti
PersistenceException may be thrown at commit time. "



Looks like you missed out some part of the sentence while posting it here Could you please edit your post to include the entire statement.
 
Tang Yue
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, I paste the full text of that quote here:
"
EntityExistsException
The EntityExistsException may thrown by the persistence provider when the persist operation is invoked and the entity already exists. The EntityExistsException may be thrown when the persist operation is invoked, or the EntityExistsException or another PersistenceException may be thrown at commit time. "
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tang Yue:

The EntityExistsException may be thrown by the persistence provider when the persist operation is invoked and the entity already exists. The EntityExistsException may be thrown when the persist operation is invoked, or the EntityExistsException or another PersistenceException may be thrown at commit time. "



Since it says "may", I think its upto the persistence provider to decide whether to throw the exception or not.
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic