List of usage examples for org.hibernate.persister.entity AbstractEntityPersister getName
public String getName()
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.java
License:Apache License
protected final QueryableCollection getCollectionPersister(ManagedType<?> ownerType, String attributeName) { AbstractEntityPersister entityPersister = getEntityPersister(ownerType); QueryableCollection collection;//from w ww . java 2 s. com do { String ownerTypeName = entityPersister.getName(); StringBuilder sb = new StringBuilder(ownerTypeName.length() + attributeName.length() + 1); sb.append(ownerTypeName); sb.append('.'); sb.append(attributeName); collection = (QueryableCollection) collectionPersisters.get(sb.toString()); if (collection == null) { String superclass = entityPersister.getEntityMetamodel().getSuperclass(); entityPersister = superclass == null ? null : (AbstractEntityPersister) entityPersisters.get(superclass); } } while (collection == null && entityPersister != null); return collection; }
From source file:com.blazebit.persistence.integration.hibernate.base.HibernateJpaProvider.java
License:Apache License
private boolean isColumnShared(AbstractEntityPersister persister, String rootName, String[] subclassNames, String attributeName) {// w w w .j a va 2 s. c o m String[] columnNames = persister.getSubclassPropertyColumnNames(attributeName); for (String subclass : subclassNames) { if (!subclass.equals(persister.getName()) && !subclass.equals(rootName)) { AbstractEntityPersister subclassPersister = (AbstractEntityPersister) entityPersisters .get(subclass); if (isColumnShared(subclassPersister, columnNames)) { return true; } } } return false; }
From source file:org.jboss.dashboard.database.hibernate.HibernateInitializer.java
License:Apache License
protected void verifyHibernateConfig() throws Exception { new HibernateTxFragment() { protected void txFragment(Session session) throws Exception { Map metadata = session.getSessionFactory().getAllClassMetadata(); for (Iterator i = metadata.values().iterator(); i.hasNext();) { final AbstractEntityPersister persister = (AbstractEntityPersister) i.next(); final String className = persister.getName(); if (!ArrayUtils.contains(verificationExcludedClassNames, className)) { log.debug("Verifying: " + className); new HibernateTxFragment(true) { protected void txFragment(Session session) throws Exception { try { boolean usingOracle = isOracleDatabase(); Query query = session.createQuery( "from " + className + " c " + (usingOracle ? " where rownum < 6" : "")); if (!usingOracle) query.setMaxResults(5); query.list(); } catch (Exception e) { log.error("Structure verification error for class " + className); log.error("Error seems to affect table named " + persister.getTableName()); log.error( "The following stack trace may help you to determine the current error cause: ", e); }//w w w . j a v a 2 s . c om } }.execute(); } } } }.execute(); }