Java Code Examples for org.hibernate.util.ArrayHelper#toIntArray()
The following examples show how to use
org.hibernate.util.ArrayHelper#toIntArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomLoader.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public int[] getNamedParameterLocs(String name) throws QueryException { Object loc = namedParameterBindPoints.get( name ); if ( loc == null ) { throw new QueryException( "Named parameter does not appear in Query: " + name, sql ); } if ( loc instanceof Integer ) { return new int[] { ( ( Integer ) loc ).intValue() }; } else { return ArrayHelper.toIntArray( ( List ) loc ); } }
Example 2
Source File: NativeSQLQueryPlan.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
private int[] getNamedParameterLocs(String name) throws QueryException { Object loc = customQuery.getNamedParameterBindPoints().get( name ); if ( loc == null ) { throw new QueryException( "Named parameter does not appear in Query: " + name, customQuery.getSQL() ); } if ( loc instanceof Integer ) { return new int[] { ((Integer) loc ).intValue() }; } else { return ArrayHelper.toIntArray( (List) loc ); } }
Example 3
Source File: HqlSqlWalker.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Returns the locations of all occurrences of the named parameter. */ public int[] getNamedParameterLocations(String name) throws QueryException { Object o = namedParameters.get( name ); if ( o == null ) { QueryException qe = new QueryException( QueryTranslator.ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR + name ); qe.setQueryString( queryTranslatorImpl.getQueryString() ); throw qe; } if ( o instanceof Integer ) { return new int[]{( ( Integer ) o ).intValue()}; } else { return ArrayHelper.toIntArray( ( ArrayList ) o ); } }
Example 4
Source File: QueryTranslatorImpl.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public int[] getNamedParameterLocs(String name) throws QueryException { Object o = namedParameters.get( name ); if ( o == null ) { QueryException qe = new QueryException( ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR + name ); qe.setQueryString( queryString ); throw qe; } if ( o instanceof Integer ) { return new int[]{ ( ( Integer ) o ).intValue() }; } else { return ArrayHelper.toIntArray( ( ArrayList ) o ); } }
Example 5
Source File: HQLQueryPlan.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
private ParameterMetadata buildParameterMetadata(ParameterTranslations parameterTranslations, String hql) { long start = System.currentTimeMillis(); ParamLocationRecognizer recognizer = ParamLocationRecognizer.parseLocations( hql ); long end = System.currentTimeMillis(); if ( log.isTraceEnabled() ) { log.trace( "HQL param location recognition took " + (end - start) + " mills (" + hql + ")" ); } int ordinalParamCount = parameterTranslations.getOrdinalParameterCount(); int[] locations = ArrayHelper.toIntArray( recognizer.getOrdinalParameterLocationList() ); if ( parameterTranslations.supportsOrdinalParameterMetadata() && locations.length != ordinalParamCount ) { throw new HibernateException( "ordinal parameter mismatch" ); } ordinalParamCount = locations.length; OrdinalParameterDescriptor[] ordinalParamDescriptors = new OrdinalParameterDescriptor[ordinalParamCount]; for ( int i = 1; i <= ordinalParamCount; i++ ) { ordinalParamDescriptors[ i - 1 ] = new OrdinalParameterDescriptor( i, parameterTranslations.supportsOrdinalParameterMetadata() ? parameterTranslations.getOrdinalParameterExpectedType( i ) : null, locations[ i - 1 ] ); } Iterator itr = recognizer.getNamedParameterDescriptionMap().entrySet().iterator(); Map namedParamDescriptorMap = new HashMap(); while( itr.hasNext() ) { final Map.Entry entry = ( Map.Entry ) itr.next(); final String name = ( String ) entry.getKey(); final ParamLocationRecognizer.NamedParameterDescription description = ( ParamLocationRecognizer.NamedParameterDescription ) entry.getValue(); namedParamDescriptorMap.put( name, new NamedParameterDescriptor( name, parameterTranslations.getNamedParameterExpectedType( name ), description.buildPositionsArray(), description.isJpaStyle() ) ); } return new ParameterMetadata( ordinalParamDescriptors, namedParamDescriptorMap ); }
Example 6
Source File: ParamLocationRecognizer.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public int[] buildPositionsArray() { return ArrayHelper.toIntArray( positions ); }