本文整理汇总了Java中org.hibernate.mapping.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于org.hibernate.mapping包,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindComposite
import org.hibernate.mapping.Component; //导入依赖的package包/类
public static void bindComposite(Element node, Component component, String path,
boolean isNullable, Mappings mappings, java.util.Map inheritedMetas)
throws MappingException {
bindComponent(
node,
component,
null,
null,
path,
isNullable,
false,
mappings,
inheritedMetas,
false
);
}
示例2: addProperty
import org.hibernate.mapping.Component; //导入依赖的package包/类
public void addProperty(Property prop, XClass declaringClass) {
if ( prop.getValue() instanceof Component ) {
//TODO handle quote and non quote table comparison
String tableName = prop.getValue().getTable().getName();
if ( getJoinsPerRealTableName().containsKey( tableName ) ) {
final Join join = getJoinsPerRealTableName().get( tableName );
addPropertyToJoin( prop, declaringClass, join );
}
else {
addPropertyToPersistentClass( prop, declaringClass );
}
}
else {
addPropertyToPersistentClass( prop, declaringClass );
}
}
示例3: ComponentPropertyHolder
import org.hibernate.mapping.Component; //导入依赖的package包/类
public ComponentPropertyHolder(
Component component,
String path,
PropertyData inferredData,
PropertyHolder parent,
Mappings mappings) {
super( path, parent, inferredData.getPropertyClass(), mappings );
final XProperty embeddedXProperty = inferredData.getProperty();
setCurrentProperty( embeddedXProperty );
this.component = component;
this.isOrWithinEmbeddedId =
parent.isOrWithinEmbeddedId()
|| ( embeddedXProperty != null &&
( embeddedXProperty.isAnnotationPresent( Id.class )
|| embeddedXProperty.isAnnotationPresent( EmbeddedId.class ) ) );
this.virtual = embeddedXProperty == null;
if ( !virtual ) {
this.embeddedAttributeName = embeddedXProperty.getName();
this.attributeConversionInfoMap = processAttributeConversions( embeddedXProperty );
}
else {
embeddedAttributeName = "";
this.attributeConversionInfoMap = Collections.emptyMap();
}
}
示例4: fillComponent
import org.hibernate.mapping.Component; //导入依赖的package包/类
public static Component fillComponent(
PropertyHolder propertyHolder,
PropertyData inferredData,
AccessType propertyAccessor,
boolean isNullable,
EntityBinder entityBinder,
boolean isComponentEmbedded,
boolean isIdentifierMapper,
boolean inSecondPass,
Mappings mappings,
Map<XClass, InheritanceState> inheritanceStatePerClass) {
return fillComponent(
propertyHolder, inferredData, null, propertyAccessor,
isNullable, entityBinder, isComponentEmbedded, isIdentifierMapper, inSecondPass, mappings,
inheritanceStatePerClass
);
}
示例5: createComponent
import org.hibernate.mapping.Component; //导入依赖的package包/类
public static Component createComponent(
PropertyHolder propertyHolder,
PropertyData inferredData,
boolean isComponentEmbedded,
boolean isIdentifierMapper,
Mappings mappings) {
Component comp = new Component( mappings, propertyHolder.getPersistentClass() );
comp.setEmbedded( isComponentEmbedded );
//yuk
comp.setTable( propertyHolder.getTable() );
//FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked.
if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) {
comp.setComponentClassName( comp.getOwner().getClassName() );
}
else {
comp.setComponentClassName( inferredData.getClassOrElementName() );
}
comp.setNodeName( inferredData.getPropertyName() );
return comp;
}
示例6: PojoInstantiator
import org.hibernate.mapping.Component; //导入依赖的package包/类
public PojoInstantiator(Component component, ReflectionOptimizer.InstantiationOptimizer optimizer) {
this.mappedClass = component.getComponentClass();
this.isAbstract = ReflectHelper.isAbstractClass( mappedClass );
this.optimizer = optimizer;
this.proxyInterface = null;
this.embeddedIdentifier = false;
try {
constructor = ReflectHelper.getDefaultConstructor(mappedClass);
}
catch ( PropertyNotFoundException pnfe ) {
LOG.noDefaultConstructor(mappedClass.getName());
constructor = null;
}
}
示例7: AbstractComponentTuplizer
import org.hibernate.mapping.Component; //导入依赖的package包/类
protected AbstractComponentTuplizer(Component component) {
propertySpan = component.getPropertySpan();
getters = new Getter[propertySpan];
setters = new Setter[propertySpan];
Iterator iter = component.getPropertyIterator();
boolean foundCustomAccessor=false;
int i = 0;
while ( iter.hasNext() ) {
Property prop = ( Property ) iter.next();
getters[i] = buildGetter( component, prop );
setters[i] = buildSetter( component, prop );
if ( !prop.isBasicPropertyAccessor() ) {
foundCustomAccessor = true;
}
i++;
}
hasCustomAccessors = foundCustomAccessor;
instantiator = buildInstantiator( component );
}
示例8: ComponentMetamodel
import org.hibernate.mapping.Component; //导入依赖的package包/类
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 );
}
示例9: bindComposite
import org.hibernate.mapping.Component; //导入依赖的package包/类
public static void bindComposite(Element node, Component component, String path,
boolean isNullable, Mappings mappings, java.util.Map inheritedMetas)
throws MappingException {
bindComponent(
node,
component,
null,
null,
path,
isNullable,
false,
mappings,
inheritedMetas,
false
);
}
示例10: PojoInstantiator
import org.hibernate.mapping.Component; //导入依赖的package包/类
public PojoInstantiator(Component component, ReflectionOptimizer.InstantiationOptimizer optimizer) {
this.mappedClass = component.getComponentClass();
this.optimizer = optimizer;
this.proxyInterface = null;
this.embeddedIdentifier = false;
try {
constructor = ReflectHelper.getDefaultConstructor(mappedClass);
}
catch ( PropertyNotFoundException pnfe ) {
log.info(
"no default (no-argument) constructor for class: " +
mappedClass.getName() +
" (class must be instantiated by Interceptor)"
);
constructor = null;
}
}
示例11: ComponentMetamodel
import org.hibernate.mapping.Component; //导入依赖的package包/类
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(), new Integer( i ) );
i++;
}
tuplizerMapping = new ComponentEntityModeToTuplizerMapping( component );
}
示例12: testProperCallbacks
import org.hibernate.mapping.Component; //导入依赖的package包/类
public void testProperCallbacks() {
ValueVisitor vv = new ValueVisitorValidator();
new Any(new Table()).accept(vv);
new Array(new RootClass()).accept(vv);
new Bag(new RootClass()).accept(vv);
new Component(new RootClass()).accept(vv);
new DependantValue(null,null).accept(vv);
new IdentifierBag(null).accept(vv);
new List(null).accept(vv);
new ManyToOne(null).accept(vv);
new Map(null).accept(vv);
new OneToMany(null).accept(vv);
new OneToOne(null, new RootClass() ).accept(vv);
new PrimitiveArray(null).accept(vv);
new Set(null).accept(vv);
new SimpleValue().accept(vv);
}
示例13: afterConfigurationBuilt
import org.hibernate.mapping.Component; //导入依赖的package包/类
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
super.afterConfigurationBuilt( mappings, dialect );
// Oracle and Postgres do not have year() functions, so we need to
// redefine the 'User.person.yob' formula
//
// consider temporary until we add the capability to define
// mapping foprmulas which can use dialect-registered functions...
PersistentClass user = mappings.getClass( User.class.getName() );
org.hibernate.mapping.Property personProperty = user.getProperty( "person" );
Component component = ( Component ) personProperty.getValue();
Formula f = ( Formula ) component.getProperty( "yob" ).getValue().getColumnIterator().next();
SQLFunction yearFunction = ( SQLFunction ) dialect.getFunctions().get( "year" );
if ( yearFunction == null ) {
// the dialect not know to support a year() function, so rely on the
// ANSI SQL extract function
f.setFormula( "extract( year from dob )");
}
else {
List args = new ArrayList();
args.add( "dob" );
f.setFormula( yearFunction.render( args, null ) );
}
}
示例14: EmbeddableMapperImpl
import org.hibernate.mapping.Component; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public EmbeddableMapperImpl(
PersisterCreationContext creationContext,
ManagedTypeImplementor superTypeDescriptor,
EmbeddableContainer compositeContainer,
String locaName,
Component embeddedMapping,
MutabilityPlan mutabilityPlan,
Comparator comparator,
List<Column> allColumns) {
super( resolveJtd( creationContext, embeddedMapping, mutabilityPlan, comparator ) );
this.compositeContainer = compositeContainer;
this.locaName = locaName;
this.roleName = compositeContainer.getRolePrefix() + '.' + locaName;
this.allColumns = allColumns;
this.ormType = new EmbeddedTypeImpl( null, roleName, getJavaTypeDescriptor() );
setTypeConfiguration( creationContext.getTypeConfiguration() );
ormType.setTypeConfiguration( creationContext.getTypeConfiguration() );
}
示例15: resolveJtd
import org.hibernate.mapping.Component; //导入依赖的package包/类
private static EmbeddableJavaTypeDescriptor resolveJtd(
PersisterCreationContext creationContext,
Component embeddedMapping,
MutabilityPlan mutabilityPlan,
Comparator comparator) {
JavaTypeDescriptorRegistry jtdr = creationContext.getTypeConfiguration().getJavaTypeDescriptorRegistry();
EmbeddableJavaTypeDescriptor jtd = (EmbeddableJavaTypeDescriptor) jtdr.getDescriptor( embeddedMapping.getType().getName() );
if ( jtd == null ) {
jtd = new EmbeddableJavaTypeDescriptorImpl(
embeddedMapping.getType().getName(),
embeddedMapping.getType().getReturnedClass(),
null,
mutabilityPlan,
comparator
);
jtdr.addDescriptor( jtd );
}
return jtd;
}