Fetch Whole Database in one Query in hibernate
Hibernate is most widely used ORM tool for Java (at least by the time I am writing this). It has lot’s of Awesome feature and tricks to manage Entities,
Implicit Inheritance is one of them. You can use a parent to fetch some entity and it will load it’s some entities.
Key: Every entity is a subclass of Object class. If you create criteria for Object class you will get all the entities data.
Session session = factory.openSession();
List l=session.createCriteria(Object.class).list();
for (Object object : l) {
System.out.println("Object: "+l);
}