Example usage for org.hibernate.mapping PersistentClass isAbstract

List of usage examples for org.hibernate.mapping PersistentClass isAbstract

Introduction

In this page you can find the example usage for org.hibernate.mapping PersistentClass isAbstract.

Prototype

Boolean isAbstract

To view the source code for org.hibernate.mapping PersistentClass isAbstract.

Click Source Link

Usage

From source file:org.eclipse.emf.teneo.hibernate.HbDataStore.java

License:Open Source License

/** Compute the top eclasses */
protected String[] computeTopEntities() {
    final ArrayList<String> result = new ArrayList<String>();
    for (Iterator<?> pcs = getClassMappings(); pcs.hasNext();) {
        final PersistentClass pc = (PersistentClass) pcs.next();

        final EClass eclass;
        if (pc.getEntityName() != null) {
            eclass = getEntityNameStrategy().toEClass(pc.getEntityName());
        } else {/*from w  ww  .  ja  v a 2  s  .c  o m*/
            eclass = EModelResolver.instance().getEClass(pc.getMappedClass());
        }

        if (eclass == null && !pc.getEntityName().equals(Constants.EAV_EOBJECT_ENTITY_NAME)) {
            continue;
        }

        java.util.List<ReferenceTo> refs = referers.get(getMappedName(pc));
        boolean topEntity = true;
        if (refs != null) {
            for (ReferenceTo referenceTo : refs) {
                ReferenceTo rt = referenceTo;
                if (rt.isContainer) {
                    topEntity = false;
                    break;
                }
            }
        }
        try {
            // see bugzilla 220106
            if (topEntity && (pc.isAbstract() == null || !pc.isAbstract())) {
                result.add(getMappedName(pc));
            }
        } catch (Exception e) {
            e.printStackTrace(System.err);
            throw new TeneoException(e.getMessage(), e);
        }
    }
    return result.toArray(new String[result.size()]);
}