Announcement Announcement Module
Collapse
No announcement yet.
Hibernate: getAllClassMetadata() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate: getAllClassMetadata()

    I'm trying figure out how to implement the following test case using the Spring. The problem is how to access the getAllClassMetadata() method with LocalSessionFactoryBean.

    ---

    SessionFactory sessionFactory = getSessionFactory();
    Map metadata = sessionFactory.getAllClassMetadata();
    for (Iterator i = metadata.values().iterator(); i.hasNext(); ) {
    Session session = sessionFactory.openSession();
    try {
    EntityPersister persister = (EntityPersister) i.next();
    String className = persister.getClassMetadata().getEntityName();
    List result = session.createQuery("from " + className + " c").list();
    } finally {
    session.close();
    }
    }

    ---

    (http://www.hibernate.org/210.html)
Working...
X