[ 
https://issues.apache.org/jira/browse/DAYTRADER-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532248
 ] 

Christopher James Blythe commented on DAYTRADER-56:
---------------------------------------------------

Spoke to some of the JPA developers and got the skinny on exceptions thrown by 
the persist method. According to them, 
the EntityExistsException during persist() will only happen if the Entity 
already exists in the PersistenceContext. Otherwise, the only way to detect 
this condition is at flush/commit time (which occurs once the session bean 
method completes).

Consequently, the only graceful way to do this is to check and see if an entity 
with the same ID exists prior (using the find() method) prior to calling 
persist().




> Register of duplicate userid in EJB 3 mode not handled correctly
> ----------------------------------------------------------------
>
>                 Key: DAYTRADER-56
>                 URL: https://issues.apache.org/jira/browse/DAYTRADER-56
>             Project: DayTrader
>          Issue Type: Bug
>          Components: EJB Tier
>    Affects Versions: 2.0
>            Reporter: Christopher James Blythe
>
> If you attempt to register a userid that already exists in the database, the 
> resulting error is not handled gracefully. In Direct mode, we catch the 
> resulting DuplicateKeyException and ensure that a warning is propagated to 
> the web-tier (by displaying a message on the register page).
> The register method in the TradeSLSBBean needs to be revised to handle this 
> gracefully.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to