Java Code Examples for org.hibernate.metadata.ClassMetadata.getMappedClass()

The following are Jave code examples for showing how to use getMappedClass() of the org.hibernate.metadata.ClassMetadata class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openeos   File: HibernateAnnotationsMixedDictionaryService.java   View Source Code Vote up 6 votes
private void loadClassDefinition(String className) {
	if (classDefinitions.containsKey(className))
		return; //For the flys

	// PersistentClass persistent = configuration.getClassMapping(className);
	ClassMetadata metadata = sessionFactory.getClassMetadata(className);
	if (metadata == null) {
		return;
	}
	HibernateAnnotationsMixedClassDefinitionImpl classDefImpl = new HibernateAnnotationsMixedClassDefinitionImpl(
			entityToStringService, sessionFactory, metadata.getMappedClass());

	String[] propertyNames = metadata.getPropertyNames();

	classDefImpl.setIdPropertyDefinition(createPropertyDefinition(metadata.getIdentifierPropertyName(),
			metadata.getIdentifierType(), metadata));
	for (String propertyName : propertyNames) {
		IPropertyDefinition propertyDef = createPropertyDefinition(propertyName, metadata.getPropertyType(propertyName),
				metadata);
		classDefImpl.addPropertyDefinition(propertyDef);
	}
	classDefinitions.put(className, classDefImpl);

}
 
Example 2
Project: debop4j   File: SearchTool.java   View Source Code Vote up 6 votes
/**
 * 인덱싱된 엔티티의 수형을 반환합니다.
 *
 * @param sessionFactory the session factory
 * @return 인덱싱된 엔티티의 수형들
 */
public static Set<Class> getIndexedClasses(SessionFactory sessionFactory) {
    if (log.isDebugEnabled())
        log.debug("매핑된 엔티티중에 인덱싱을 수행할 엔티티들을 조회합니다.");

    final Set<Class> classes = Sets.newHashSet();
    Collection<ClassMetadata> metadatas = sessionFactory.getAllClassMetadata().values();

    for (ClassMetadata meta : metadatas) {
        Class clazz = meta.getMappedClass();
        if (clazz.getAnnotation(Indexed.class) != null) {
            classes.add(clazz);

                log.trace("인덱싱된 엔티티=[{}]", clazz);
        }
    }
    return classes;
}
 
Example 3
Project: gitplex-mit   File: DefaultIdManager.java   View Source Code Vote up 5 votes
@Sessional
@Override
public void init() {
	for (ClassMetadata metadata: persistManager.getSessionFactory().getAllClassMetadata().values()) {
		Class<?> entityClass = metadata.getMappedClass();
		nextIds.put(entityClass, new AtomicLong(getMaxId(entityClass)+1));
	}
}
 
Example 4
Project: ix3   File: MetaDataFactoryImplHibernate.java   View Source Code Vote up 5 votes
@Override
public MetaData getMetaData(Class entityClass) {
    ClassMetadata classMetadata=getClassMetadata(entityClass);
    if (classMetadata==null) {
        return null;
    } else {
        return new MetaDataImplHibernate(classMetadata.getMappedClass(),sessionFactory,null,null,classMetadata.getMappedClass().getSimpleName());
    }
}
 
Example 5
Project: ix3   File: MetaDataFactoryImplHibernate.java   View Source Code Vote up 5 votes
@Override
public MetaData getMetaData(String entityName) {
    ClassMetadata classMetadata=getClassMetadata(entityName);
    if (classMetadata==null) {
        return null;
    } else {
        return new MetaDataImplHibernate(classMetadata.getMappedClass(),sessionFactory,null,null,entityName);
    }
}