javax.persistence.Cacheable Java Examples

The following examples show how to use javax.persistence.Cacheable. 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 Cacheable getCacheable(Element element, XMLContext.Default defaults){
	if ( element != null ) {
		String attValue = element.attributeValue( "cacheable" );
		if ( attValue != null ) {
			AnnotationDescriptor ad = new AnnotationDescriptor( Cacheable.class );
			ad.setValue( "value", Boolean.valueOf( attValue ) );
			return AnnotationFactory.create( ad );
		}
	}
	if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( Cacheable.class );
	}
	else {
		return null;
	}
}
 
Example #2
Source File: EntityType.java    From requery with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isCacheable() {
    return annotationOf(Entity.class).map(Entity::cacheable)
        .orElse( annotationOf(Cacheable.class).map(Cacheable::value).orElse(true));
}