本文整理汇总了Java中org.hibernate.EntityMode.POJO属性的典型用法代码示例。如果您正苦于以下问题:Java EntityMode.POJO属性的具体用法?Java EntityMode.POJO怎么用?Java EntityMode.POJO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.hibernate.EntityMode
的用法示例。
在下文中一共展示了EntityMode.POJO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComponentMetamodel
public ComponentMetamodel(Component component) {
// this.sessionFactory = sessionFactory;
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 ComponentTuplizerFactory componentTuplizerFactory = new ComponentTuplizerFactory();
final String tuplizerClassName = component.getTuplizerImplClassName( entityMode );
this.componentTuplizer = tuplizerClassName == null ? componentTuplizerFactory.constructDefaultTuplizer(
entityMode,
component
) : componentTuplizerFactory.constructTuplizer( tuplizerClassName, component );
}
示例2: getExplicitTuplizerClassName
@Override
public String getExplicitTuplizerClassName() {
if ( componentElement.getTuplizer() == null ) {
return null;
}
final EntityMode entityMode = StringHelper.isEmpty( componentElement.getClazz() ) ? EntityMode.MAP : EntityMode.POJO;
for ( JaxbTuplizerElement tuplizerElement : componentElement.getTuplizer() ) {
if ( entityMode == EntityMode.parse( tuplizerElement.getEntityMode() ) ) {
return tuplizerElement.getClazz();
}
}
return null;
}
示例3: getExplicitTuplizerClassName
@Override
public String getExplicitTuplizerClassName() {
if ( compositeElement.getTuplizer() == null ) {
return null;
}
final EntityMode entityMode = StringHelper.isEmpty( compositeElement.getClazz() ) ? EntityMode.MAP : EntityMode.POJO;
for ( JaxbTuplizerElement tuplizerElement : compositeElement.getTuplizer() ) {
if ( entityMode == EntityMode.parse( tuplizerElement.getEntityMode() ) ) {
return tuplizerElement.getClazz();
}
}
return null;
}
示例4: determineCustomTuplizer
private String determineCustomTuplizer() {
final AnnotationInstance tuplizersAnnotation = JandexHelper.getSingleAnnotation(
classInfo, HibernateDotNames.TUPLIZERS
);
if ( tuplizersAnnotation == null ) {
return null;
}
AnnotationInstance[] annotations = JandexHelper.getValue(
tuplizersAnnotation,
"value",
AnnotationInstance[].class
);
AnnotationInstance pojoTuplizerAnnotation = null;
for ( AnnotationInstance tuplizerAnnotation : annotations ) {
if ( EntityMode.valueOf( tuplizerAnnotation.value( "entityModeType" ).asEnum() ) == EntityMode.POJO ) {
pojoTuplizerAnnotation = tuplizerAnnotation;
break;
}
}
String customTuplizer = null;
if ( pojoTuplizerAnnotation != null ) {
customTuplizer = pojoTuplizerAnnotation.value( "impl" ).asString();
}
return customTuplizer;
}
示例5: nullSafeGet
public Object nullSafeGet(
ResultSet rs,
String name,
SessionImplementor session,
Object owner) throws HibernateException, SQLException {
final Object discriminatorValue = underlyingType.nullSafeGet( rs, name, session, owner );
final String entityName = persister.getSubclassForDiscriminatorValue( discriminatorValue );
if ( entityName == null ) {
throw new HibernateException( "Unable to resolve discriminator value [" + discriminatorValue + "] to entity name" );
}
final EntityPersister entityPersister = session.getEntityPersister( entityName, null );
return ( EntityMode.POJO == entityPersister.getEntityMode() ) ? entityPersister.getMappedClass() : entityName;
}
示例6: getTypedValues
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
TypedValue[] superTv = super.getTypedValues(criteria, criteriaQuery);
TypedValue[] result = new TypedValue[superTv.length+1];
System.arraycopy(superTv, 0, result, 1, superTv.length);
result[0] = new TypedValue( getTypes()[0], value, EntityMode.POJO );
return result;
}
示例7: getTypedValues
public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
Type[] types = params.getPositionalParameterTypes();
Object[] values = params.getPositionalParameterValues();
TypedValue[] tv = new TypedValue[types.length];
for ( int i=0; i<types.length; i++ ) {
tv[i] = new TypedValue( types[i], values[i], EntityMode.POJO );
}
return tv;
}
示例8: SQLCriterion
protected SQLCriterion(String sql, Object[] values, Type[] types) {
this.sql = sql;
typedValues = new TypedValue[values.length];
for ( int i=0; i<typedValues.length; i++ ) {
typedValues[i] = new TypedValue( types[i], values[i], EntityMode.POJO );
}
}
示例9: getTypedIdentifierValue
public TypedValue getTypedIdentifierValue(Criteria subcriteria, Object value) {
final Loadable loadable = ( Loadable ) getPropertyMapping( getEntityName( subcriteria ) );
return new TypedValue(
loadable.getIdentifierType(),
value,
EntityMode.POJO
);
}
示例10: getTypedValue
/**
* Get the a typed value for the given property value.
*/
public TypedValue getTypedValue(Criteria subcriteria, String propertyName, Object value)
throws HibernateException {
// Detect discriminator values...
if ( value instanceof Class ) {
Class entityClass = ( Class ) value;
Queryable q = SessionFactoryHelper.findQueryableUsingImports( sessionFactory, entityClass.getName() );
if ( q != null ) {
Type type = q.getDiscriminatorType();
String stringValue = q.getDiscriminatorSQLValue();
// Convert the string value into the proper type.
if ( type instanceof NullableType ) {
NullableType nullableType = ( NullableType ) type;
value = nullableType.fromStringValue( stringValue );
}
else {
throw new QueryException( "Unsupported discriminator type " + type );
}
return new TypedValue(
type,
value,
EntityMode.POJO
);
}
}
// Otherwise, this is an ordinary value.
return new TypedValue(
getTypeUsingProjection( subcriteria, propertyName ),
value,
EntityMode.POJO
);
}
示例11: evictEntity
public void evictEntity(String entityName, Serializable id) throws HibernateException {
EntityPersister p = getEntityPersister(entityName);
if ( p.hasCache() ) {
if ( log.isDebugEnabled() ) {
log.debug( "evicting second-level cache: " + MessageHelper.infoString(p, id, this) );
}
CacheKey cacheKey = new CacheKey( id, p.getIdentifierType(), p.getRootEntityName(), EntityMode.POJO, this );
p.getCache().remove( cacheKey );
}
}
示例12: evict
public void evict(Class persistentClass, Serializable id) throws HibernateException {
EntityPersister p = getEntityPersister( persistentClass.getName() );
if ( p.hasCache() ) {
if ( log.isDebugEnabled() ) {
log.debug( "evicting second-level cache: " + MessageHelper.infoString(p, id, this) );
}
CacheKey cacheKey = new CacheKey( id, p.getIdentifierType(), p.getRootEntityName(), EntityMode.POJO, this );
p.getCache().remove( cacheKey );
}
}
示例13: evictCollection
public void evictCollection(String roleName, Serializable id) throws HibernateException {
CollectionPersister p = getCollectionPersister(roleName);
if ( p.hasCache() ) {
if ( log.isDebugEnabled() ) {
log.debug( "evicting second-level cache: " + MessageHelper.collectionInfoString(p, id, this) );
}
CacheKey cacheKey = new CacheKey( id, p.getKeyType(), p.getRole(), EntityMode.POJO, this );
p.getCache().remove( cacheKey );
}
}
示例14: guessEntityMode
public EntityMode guessEntityMode(Object object) {
if ( !isInstance(object, EntityMode.POJO) ) {
return null;
}
else {
return EntityMode.POJO;
}
}
示例15: buildBasicEntityBinding
private EntityBinding buildBasicEntityBinding(EntitySource entitySource, EntityBinding superEntityBinding) {
final EntityBinding entityBinding = superEntityBinding == null
? new EntityBinding( currentInheritanceType, currentHierarchyEntityMode )
: new EntityBinding( superEntityBinding );
final String entityName = entitySource.getEntityName();
final String className = currentHierarchyEntityMode == EntityMode.POJO ? entitySource.getClassName() : null;
final Entity entity = new Entity(
entityName,
className,
currentBindingContext.makeClassReference( className ),
superEntityBinding == null ? null : superEntityBinding.getEntity()
);
entityBinding.setEntity( entity );
entityBinding.setJpaEntityName( entitySource.getJpaEntityName() );
if ( currentHierarchyEntityMode == EntityMode.POJO ) {
final String proxy = entitySource.getProxy();
if ( proxy != null ) {
entityBinding.setProxyInterfaceType(
currentBindingContext.makeClassReference(
currentBindingContext.qualifyClassName( proxy )
)
);
entityBinding.setLazy( true );
}
else if ( entitySource.isLazy() ) {
entityBinding.setProxyInterfaceType( entityBinding.getEntity().getClassReferenceUnresolved() );
entityBinding.setLazy( true );
}
}
else {
entityBinding.setProxyInterfaceType( null );
entityBinding.setLazy( entitySource.isLazy() );
}
final String customTuplizerClassName = entitySource.getCustomTuplizerClassName();
if ( customTuplizerClassName != null ) {
entityBinding.setCustomEntityTuplizerClass(
currentBindingContext.<EntityTuplizer>locateClassByName(
customTuplizerClassName
)
);
}
final String customPersisterClassName = entitySource.getCustomPersisterClassName();
if ( customPersisterClassName != null ) {
entityBinding.setCustomEntityPersisterClass(
currentBindingContext.<EntityPersister>locateClassByName(
customPersisterClassName
)
);
}
entityBinding.setMetaAttributeContext( buildMetaAttributeContext( entitySource ) );
entityBinding.setDynamicUpdate( entitySource.isDynamicUpdate() );
entityBinding.setDynamicInsert( entitySource.isDynamicInsert() );
entityBinding.setBatchSize( entitySource.getBatchSize() );
entityBinding.setSelectBeforeUpdate( entitySource.isSelectBeforeUpdate() );
entityBinding.setAbstract( entitySource.isAbstract() );
entityBinding.setCustomLoaderName( entitySource.getCustomLoaderName() );
entityBinding.setCustomInsert( entitySource.getCustomSqlInsert() );
entityBinding.setCustomUpdate( entitySource.getCustomSqlUpdate() );
entityBinding.setCustomDelete( entitySource.getCustomSqlDelete() );
if ( entitySource.getSynchronizedTableNames() != null ) {
entityBinding.addSynchronizedTableNames( entitySource.getSynchronizedTableNames() );
}
entityBinding.setJpaCallbackClasses(entitySource.getJpaCallbackClasses());
return entityBinding;
}