javax.persistence.SqlResultSetMappings Java Examples

The following examples show how to use javax.persistence.SqlResultSetMappings. 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: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 File: QueryBinder.java    From lams with 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
Source File: CreateXAnnotations.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
				}
			});
}