I am using criteria query to fetch list of records from database VIEW.[code=java] I have created the corresponding HBM.xml and POJO files.
OuterView.hbm.xml corresponds to OuterView.java, which contains a composite key of class InnerView.java.
OuterView.java contains only one attribute as InnerView and InnerView contains all the column names and their getters and setters.
I am creating criteria on OuterView.java and the query is being fired too. But when I am fetching the returned list, it gives me a list with NULL objects in it. I cannot get the data neither in OuterView nor in InnerView.
Can you please help me out? Is there something that I am missing?
Maybe try having Hibernate output the sql it is running on the database. If you then run this same query on the database using your tool and get different results, then it has to do with your configuration.
You can put the following in your hibernate.cfg.xml file to see nicely formatted SQL:
I tried to see the query in console and it is being fired. Also the data is properly being fetched using my tool. The only thing is that hibernate is not binding the data values with those in java file. This is quite wierd because it is firing the query properly using the criteria but not putting the same obtained values in that java file on return.