I am just concerned, why while using Hibernate criteria from http://www.tutorialspoint.com/hibernate/hibernate_criteria_queries.htm
Criteria cr = session.createCriteria(Employee.class);
cr.add(Restrictions.eq("salary", 2000));
List results = cr.list();
If in my database Employee class does not have salary column, or even worse - Employee is not mapped, results will be an empty list and hibernate will not throw errors.
I thought it is the problem of implicit-polymorphism, but firstly Im not extenting anything, secondly if I'll use session.delete, session.save, session.update everything goes correctly and I get all those exceptions like NoSuchFieldException, UnknownEntity and so on.
But while getting objects using criteria - just empty list. Is it as it supposed to be? Can I somehow check if class/field I am searching for exists in DB?
All the questions about it on StackOverflow concerns the problem, when criteria returns empty list, while they have got objects in database. I want to know why my criteria returns empty list, while it should throw error...
Mine hibernate config file: `
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">******</property>
<property name="hibernate.connection.url">*******</property>
<property name="hibernate.connection.username">******</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.search.autoregister_listeners">false</property>
<property name="hibernate.show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
<mapping resource="employee.hbm.xml" />
</session-factory>
</hibernate-configuration>
`