@ FFDCIgnore ( { EntityExistsException . class , PersistenceException . class , Exception . class } ) @ Override public boolean createProperty ( String name , String value ) throws Exception { EntityManager em = getPersistenceServiceUnit ( ) . createEntityManager ( ) ; Property property = new Property ( name , value ) ; try { em . persist ( property ) ; em . flush ( ) ; } catch ( EntityExistsException x ) { return false ; } catch ( PersistenceException x ) { // Some JPA providers may throw PersistenceException for some scenarios where it can be // determined the row really does exist; handle those here if ( x . getCause ( ) instanceof SQLIntegrityConstraintViolationException ) { return false ; } try { em . detach ( property ) ; // ensure em.find won't return object from cache if ( em . find ( Property . class , name ) != null ) { return false ; } } catch ( Exception ex ) { // Oddly, JPA has not defined exceptions for em.find; throws subclass of RuntimeException // Do not FFDC; just adds extra clutter (original will be FFDC'd below) if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "createProperty" , ex ) ; } FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "309" , this ) ; throw x ; } finally { em . close ( ) ; } return true ; }
Create a property entry in the persistent store .