本文整理汇总了Java中org.hibernate.tuple.entity.EntityMetamodel类的典型用法代码示例。如果您正苦于以下问题:Java EntityMetamodel类的具体用法?Java EntityMetamodel怎么用?Java EntityMetamodel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityMetamodel类属于org.hibernate.tuple.entity包,在下文中一共展示了EntityMetamodel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixCompositeIdentifierInMetaModel
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
private static void fixCompositeIdentifierInMetaModel(SessionFactory sessionFactory, Class clazz) {
ClassMetadata classMetadata = sessionFactory.getClassMetadata(clazz);
if (classMetadata instanceof AbstractEntityPersister) {
AbstractEntityPersister persister = (AbstractEntityPersister) classMetadata;
EntityMetamodel model = persister.getEntityMetamodel();
IdentifierProperty identifier = model.getIdentifierProperty();
try {
Field field = IdentifierProperty.class.getDeclaredField("hasIdentifierMapper");
field.setAccessible(true);
field.set(identifier, true);
field.setAccessible(false);
} catch (Exception ex) {
throw new SystemException("Attempt to fix entity meta model with hack failed, reason: "
+ ex.getMessage(), ex);
}
}
}
示例2: OBDynamicTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public OBDynamicTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super(entityMetamodel, mappedEntity);
log.debug("Created tuplizer for "
+ (mappedEntity.getMappedClass() != null ? mappedEntity.getMappedClass().getName()
: mappedEntity.getEntityName()));
persistentClass = mappedEntity;
}
示例3: PojoEntityTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super( entityMetamodel, mappedEntity );
this.mappedClass = mappedEntity.getMappedClass();
this.proxyInterface = mappedEntity.getProxyInterface();
this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass );
this.validatableImplementor = Validatable.class.isAssignableFrom( mappedClass );
Iterator iter = mappedEntity.getPropertyClosureIterator();
while ( iter.hasNext() ) {
Property property = (Property) iter.next();
if ( property.isLazy() ) {
lazyPropertyNames.add( property.getName() );
}
}
String[] getterNames = new String[propertySpan];
String[] setterNames = new String[propertySpan];
Class[] propTypes = new Class[propertySpan];
for ( int i = 0; i < propertySpan; i++ ) {
getterNames[i] = getters[i].getMethodName();
setterNames[i] = setters[i].getMethodName();
propTypes[i] = getters[i].getReturnType();
}
if ( hasCustomAccessors || !Environment.useReflectionOptimizer() ) {
optimizer = null;
}
else {
// todo : YUCK!!!
optimizer = Environment.getBytecodeProvider().getReflectionOptimizer( mappedClass, getterNames, setterNames, propTypes );
// optimizer = getFactory().getSettings().getBytecodeProvider().getReflectionOptimizer(
// mappedClass, getterNames, setterNames, propTypes
// );
}
}
示例4: PartCollectionEntityTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
/**
* Default constructor.
* @param entityModel entity model class
* @param persistentClass persistent class
*/
public PartCollectionEntityTuplizer(EntityMetamodel entityModel, PersistentClass persistentClass) {
super(entityModel, persistentClass);
propertyNames = new String[propertySpan];
Iterator propertiesIterator = persistentClass.getPropertyIterator();
int count = 0;
while (propertiesIterator.hasNext()) {
propertyNames[count++] = ((Property) propertiesIterator.next()).getName();
}
}
示例5: getEntityMetamodel
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public EntityMetamodel getEntityMetamodel() {
return entityMetamodel;
}
示例6: collectAttributeDefinitions
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
private void collectAttributeDefinitions(
Map<String,AttributeDefinition> attributeDefinitionsByName,
EntityMetamodel metamodel) {
for ( int i = 0; i < metamodel.getPropertySpan(); i++ ) {
final AttributeDefinition attributeDefinition = metamodel.getProperties()[i];
// Don't replace an attribute definition if it is already in attributeDefinitionsByName
// because the new value will be from a subclass.
final AttributeDefinition oldAttributeDefinition = attributeDefinitionsByName.get(
attributeDefinition.getName()
);
if ( oldAttributeDefinition != null ) {
if ( LOG.isTraceEnabled() ) {
LOG.tracef(
"Ignoring subclass attribute definition [%s.%s] because it is defined in a superclass ",
entityMetamodel.getName(),
attributeDefinition.getName()
);
}
}
else {
attributeDefinitionsByName.put( attributeDefinition.getName(), attributeDefinition );
}
}
// see if there are any subclass persisters...
final Set<String> subClassEntityNames = metamodel.getSubclassEntityNames();
if ( subClassEntityNames == null ) {
return;
}
// see if we can find the persisters...
for ( String subClassEntityName : subClassEntityNames ) {
if ( metamodel.getName().equals( subClassEntityName ) ) {
// skip it
continue;
}
try {
final EntityPersister subClassEntityPersister = factory.getEntityPersister( subClassEntityName );
collectAttributeDefinitions( attributeDefinitionsByName, subClassEntityPersister.getEntityMetamodel() );
}
catch (MappingException e) {
throw new IllegalStateException(
String.format(
"Could not locate subclass EntityPersister [%s] while processing EntityPersister [%s]",
subClassEntityName,
metamodel.getName()
),
e
);
}
}
}
示例7: getEntityMetamodel
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
@Override
public EntityMetamodel getEntityMetamodel() {
// TODO Auto-generated method stub
return null;
}
示例8: OBTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public OBTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super(entityMetamodel, mappedEntity);
log.debug("Created tuplizer for "
+ (mappedEntity.getMappedClass() != null ? mappedEntity.getMappedClass().getName()
: mappedEntity.getEntityName()));
}
示例9: GroovyAwarePojoEntityTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public GroovyAwarePojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super(entityMetamodel, mappedEntity);
}
示例10: getEntityMetamodel
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public EntityMetamodel getEntityMetamodel() {
return null;
}
示例11: MyEntityTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public MyEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
super( entityMetamodel, mappedEntity );
}
示例12: AbstractEntityTuplizerImpl
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public AbstractEntityTuplizerImpl(EntityMetamodel entityMetamodel, PersistentClass persistentClass) {
super(entityMetamodel, persistentClass);
}
示例13: addClass
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
/**
* Add the metadata for an entity.
*
* @param meta
*/
void addClass(ClassMetadata meta) {
Class type = meta.getMappedClass();
String classKey = getEntityTypeName(type);
HashMap<String, Object> cmap = new LinkedHashMap<String, Object>();
_typeList.add(cmap);
cmap.put("shortName", type.getSimpleName());
cmap.put("namespace", type.getPackage().getName());
EntityMetamodel metaModel = ((EntityPersister) meta).getEntityMetamodel();
String superTypeName = metaModel.getSuperclass();
if (superTypeName != null) {
ClassMetadata superMeta = _sessionFactory.getClassMetadata(superTypeName);
if (superMeta != null) {
Class superClass = superMeta.getMappedClass();
cmap.put("baseTypeName", getEntityTypeName(superClass));
}
}
String genType = "None";
if (meta instanceof EntityPersister) {
EntityPersister entityPersister = (EntityPersister) meta;
// multipart keys can never have an AutoGeneratedKeyType
if (entityPersister.hasIdentifierProperty()) {
IdentifierGenerator generator = entityPersister != null
? entityPersister.getIdentifierGenerator()
: null;
if (generator != null) {
if (generator instanceof IdentityGenerator) {
genType = "Identity";
} else if (generator instanceof Assigned || generator instanceof ForeignGenerator) {
genType = "None";
} else {
genType = "KeyGenerator";
}
// TODO find the real generator
}
}
}
cmap.put("autoGeneratedKeyType", genType);
String resourceName = pluralize(type.getSimpleName()); // TODO find the real name
cmap.put("defaultResourceName", resourceName);
_resourceMap.put(resourceName, classKey);
ArrayList<HashMap<String, Object>> dataArrayList = new ArrayList<HashMap<String, Object>>();
cmap.put("dataProperties", dataArrayList);
ArrayList<HashMap<String, Object>> navArrayList = new ArrayList<HashMap<String, Object>>();
cmap.put("navigationProperties", navArrayList);
addClassProperties(meta, dataArrayList, navArrayList);
}
示例14: OptionAwarePojoEntityTuplizer
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
public OptionAwarePojoEntityTuplizer(EntityMetamodel emm, EntityBinding eb) {
super(emm, eb);
}
示例15: getEntityMetamodel
import org.hibernate.tuple.entity.EntityMetamodel; //导入依赖的package包/类
/**
* Retrieve the underlying entity metamodel instance...
*
*@return The metamodel
*/
public EntityMetamodel getEntityMetamodel();