private void readFromDBAttributes ( ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; try { stmt = con . createStatement ( ) ; final StringBuilder cmd = new StringBuilder ( "select " ) ; for ( final AttrName attrName : Person . AttrName . values ( ) ) { cmd . append ( attrName . sqlColumn ) . append ( "," ) ; } cmd . append ( "0 as DUMMY " ) . append ( "from V_USERPERSON " ) . append ( "where V_USERPERSON.ID=" ) . append ( getId ( ) ) ; final ResultSet resultset = stmt . executeQuery ( cmd . toString ( ) ) ; if ( resultset . next ( ) ) { for ( final AttrName attrName : Person . AttrName . values ( ) ) { final String tmp = resultset . getString ( attrName . sqlColumn ) ; setAttrValue ( attrName , tmp == null ? null : tmp . trim ( ) ) ; } } resultset . close ( ) ; } catch ( final SQLException e ) { Person . LOG . error ( "read attributes for person with SQL statement is not " + "possible" , e ) ; throw new EFapsException ( Person . class , "readFromDBAttributes.SQLException" , e , getName ( ) , getId ( ) ) ; } finally { try { if ( stmt != null ) { stmt . close ( ) ; } con . commit ( ) ; } catch ( final SQLException e ) { Person . LOG . error ( "close of SQL statement is not possible" , e ) ; } } } finally { try { if ( con != null && ! con . isClosed ( ) ) { con . close ( ) ; } } catch ( final SQLException e ) { throw new CacheReloadException ( "could not read child type ids" , e ) ; } } }
All attributes from this person are read from the database .