private Version getSimpleVersion ( String product ) { final Tuple coreNumbers ; try { final TypedQuery < Tuple > coreNumbersQuery = this . createQuery ( this . findCoreVersionNumbers ) ; coreNumbersQuery . setParameter ( this . productParameter , product ) ; coreNumbers = DataAccessUtils . singleResult ( coreNumbersQuery . getResultList ( ) ) ; } catch ( SQLGrammarException e ) { logger . warn ( "UP_VERSION table doesn't exist, returning null for version of " + product ) ; return null ; } if ( coreNumbers == null ) { // Table exists but no version data for the product return null ; } // Pull out the maj/min/pat values final Integer major = coreNumbers . get ( VersionImpl_ . major . getName ( ) , VersionImpl_ . major . getBindableJavaType ( ) ) ; final Integer minor = coreNumbers . get ( VersionImpl_ . minor . getName ( ) , VersionImpl_ . minor . getBindableJavaType ( ) ) ; final Integer patch = coreNumbers . get ( VersionImpl_ . patch . getName ( ) , VersionImpl_ . patch . getBindableJavaType ( ) ) ; // See if the optional local version value exists Integer local ; try { final TypedQuery < Integer > localNumberQuery = this . createQuery ( this . findLocalVersionNumber ) ; localNumberQuery . setParameter ( this . productParameter , product ) ; local = DataAccessUtils . singleResult ( localNumberQuery . getResultList ( ) ) ; } catch ( PersistenceException e ) { local = null ; } return new VersionImpl ( product , major , minor , patch , local ) ; }
Load a Version object with direct field queries . Used to deal with DB upgrades where not all of the fields have been loaded