Java Code Examples for org.hibernate.EntityMode#MAP

The following examples show how to use org.hibernate.EntityMode#MAP . 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: Property.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public PropertyAccessStrategy getPropertyAccessStrategy(Class clazz) throws MappingException {
	String accessName = getPropertyAccessorName();
	if ( accessName == null ) {
		if ( clazz == null || java.util.Map.class.equals( clazz ) ) {
			accessName = "map";
		}
		else {
			accessName = "property";
		}
	}

	final EntityMode entityMode = clazz == null || java.util.Map.class.equals( clazz )
			? EntityMode.MAP
			: EntityMode.POJO;

	return resolveServiceRegistry().getService( PropertyAccessStrategyResolver.class ).resolvePropertyAccessStrategy(
			clazz,
			accessName,
			entityMode
	);
}
 
Example 2
Source File: PropertyAccessStrategyResolverStandardImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public PropertyAccessStrategy resolvePropertyAccessStrategy(
		Class containerClass,
		String explicitAccessStrategyName,
		EntityMode entityMode) {

	if ( BuiltInPropertyAccessStrategies.BASIC.getExternalName().equals( explicitAccessStrategyName )
			|| BuiltInPropertyAccessStrategies.FIELD.getExternalName().equals( explicitAccessStrategyName )
			|| BuiltInPropertyAccessStrategies.MIXED.getExternalName().equals( explicitAccessStrategyName ) ) {
		if ( Managed.class.isAssignableFrom( containerClass ) ) {
			// PROPERTY (BASIC) and MIXED are not valid for bytecode enhanced entities...
			return PropertyAccessStrategyEnhancedImpl.INSTANCE;
		}
	}

	if ( StringHelper.isNotEmpty( explicitAccessStrategyName ) ) {
		return resolveExplicitlyNamedPropertyAccessStrategy( explicitAccessStrategyName );
	}

	if ( entityMode == EntityMode.MAP ) {
		return BuiltInPropertyAccessStrategies.MAP.getStrategy();
	}
	else {
		return BuiltInPropertyAccessStrategies.BASIC.getStrategy();
	}
}
 
Example 3
Source File: ComponentMetamodel.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ComponentMetamodel(Component component, ComponentTuplizerFactory componentTuplizerFactory){
	this.role = component.getRoleName();
	this.isKey = component.isKey();
	propertySpan = component.getPropertySpan();
	properties = new StandardProperty[propertySpan];
	Iterator itr = component.getPropertyIterator();
	int i = 0;
	while ( itr.hasNext() ) {
		Property property = ( Property ) itr.next();
		properties[i] = PropertyFactory.buildStandardProperty( property, false );
		propertyIndexes.put( property.getName(), i );
		i++;
	}

	entityMode = component.hasPojoRepresentation() ? EntityMode.POJO : EntityMode.MAP;

	// todo : move this to SF per HHH-3517; also see HHH-1907 and ComponentMetamodel
	final String tuplizerClassName = component.getTuplizerImplClassName( entityMode );
	this.componentTuplizer = tuplizerClassName == null ? componentTuplizerFactory.constructDefaultTuplizer(
			entityMode,
			component
	) : componentTuplizerFactory.constructTuplizer( tuplizerClassName, component );

	final ConfigurationService cs = component.getMetadata().getMetadataBuildingOptions().getServiceRegistry()
			.getService(ConfigurationService.class);

	this.createEmptyCompositesEnabled = ConfigurationHelper.getBoolean(
			Environment.CREATE_EMPTY_COMPOSITES_ENABLED,
			cs.getSettings(),
			false
	);
}
 
Example 4
Source File: DynamicMapEntityTuplizer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public EntityMode getEntityMode() {
	return EntityMode.MAP;
}
 
Example 5
Source File: AbstractEntitySourceImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected EntityMode determineEntityMode() {
	return StringHelper.isNotEmpty( entityNamingSource.getClassName() ) ? EntityMode.POJO : EntityMode.MAP;
}
 
Example 6
Source File: DynamicMapEntityTuplizer.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public EntityMode getEntityMode() {
	return EntityMode.MAP;
}