Java Code Examples for org.hibernate.query.NativeQuery#ReturnProperty

The following examples show how to use org.hibernate.query.NativeQuery#ReturnProperty . 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: NativeQueryReturnBuilderFetchImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public NativeQuery.ReturnProperty addProperty(final String propertyName) {
	if ( propertyMappings == null ) {
		propertyMappings = new HashMap<>();
	}
	return new NativeQuery.ReturnProperty() {
		public NativeQuery.ReturnProperty addColumnAlias(String columnAlias) {
			String[] columnAliases = propertyMappings.get( propertyName );
			if ( columnAliases == null ) {
				columnAliases = new String[] {columnAlias};
			}
			else {
				String[] newColumnAliases = new String[columnAliases.length + 1];
				System.arraycopy( columnAliases, 0, newColumnAliases, 0, columnAliases.length );
				newColumnAliases[columnAliases.length] = columnAlias;
				columnAliases = newColumnAliases;
			}
			propertyMappings.put( propertyName, columnAliases );
			return this;
		}
	};
}
 
Example 2
Source File: NativeQueryReturnBuilderRootImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public NativeQuery.ReturnProperty addProperty(final String propertyName) {
	if ( propertyMappings == null ) {
		propertyMappings = new HashMap<>();
	}
	return new NativeQuery.ReturnProperty() {
		public NativeQuery.ReturnProperty addColumnAlias(String columnAlias) {
			String[] columnAliases = propertyMappings.get( propertyName );
			if ( columnAliases == null ) {
				columnAliases = new String[] {columnAlias};
			}
			else {
				String[] newColumnAliases = new String[columnAliases.length + 1];
				System.arraycopy( columnAliases, 0, newColumnAliases, 0, columnAliases.length );
				newColumnAliases[columnAliases.length] = columnAlias;
				columnAliases = newColumnAliases;
			}
			propertyMappings.put( propertyName, columnAliases );
			return this;
		}
	};
}