Java Code Examples for javax.persistence.SqlResultSetMappings

The following examples show how to use javax.persistence.SqlResultSetMappings. These examples are extracted from open source projects. 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
private SqlResultSetMappings getSqlResultSetMappings(Element tree, XMLContext.Default defaults) {
	List<SqlResultSetMapping> results = buildSqlResultsetMappings( tree, defaults, classLoaderAccess );
	if ( defaults.canUseJavaAnnotations() ) {
		SqlResultSetMapping annotation = getPhysicalAnnotation( SqlResultSetMapping.class );
		addSqlResultsetMappingIfNeeded( annotation, results );
		SqlResultSetMappings annotations = getPhysicalAnnotation( SqlResultSetMappings.class );
		if ( annotations != null ) {
			for ( SqlResultSetMapping current : annotations.value() ) {
				addSqlResultsetMappingIfNeeded( current, results );
			}
		}
	}
	if ( results.size() > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( SqlResultSetMappings.class );
		ad.setValue( "value", results.toArray( new SqlResultSetMapping[results.size()] ) );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
Example 2
Source Project: lams   Source File: QueryBinder.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void bindSqlResultSetMappings(
		SqlResultSetMappings ann,
		MetadataBuildingContext context,
		boolean isDefault) {
	if ( ann == null ) {
		return;
	}

	for (SqlResultSetMapping rs : ann.value()) {
		//no need to handle inSecondPass
		context.getMetadataCollector().addSecondPass( new ResultsetMappingSecondPass( rs, context, true ) );
	}
}
 
Example 3
public XAnnotation<?> createSqlResultSetMapping(
		Collection<SqlResultSetMapping> cSqlResultSetMappings) {
	return transform(
			SqlResultSetMappings.class,
			javax.persistence.SqlResultSetMapping.class,
			cSqlResultSetMappings,
			new Transformer<SqlResultSetMapping, XAnnotation<javax.persistence.SqlResultSetMapping>>() {
				public XAnnotation<javax.persistence.SqlResultSetMapping> transform(
						SqlResultSetMapping input) {
					return createSqlResultSetMapping(input);
				}
			});
}