Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]The problem we are facing is very straight forward but we are not able to find the solution of the problem.
The cache we are using is EHCache. The collections we are using in our hibernate class is getting cached.[/b]
[b]Scenario:[/b]
We have a product class which maps to the product table in the database. A product have assets(images) related to it which are stored in seprate table and we have ProductAsset class for that table. These Assets are present as List in the class and mapped as bag in hbm.xml one more thing to note down is that this collection has lazy="true" settings.
[b]Problem:[/b]
Now if i query for first time for a product using any Criteria i got a list of products and those are getting cached as well, the i call an API to get list of assets say product.getAssets(), hibernate again fires the query for getting assets which is fine and assets are also getting cahced. But if i fire the same thing again then only products are getting resolved from the second-level cache and not the assets for assets hibernate is again firing queries.
We are just clueless why it is happening, we have implemented the hashcode() and equals() method as well properly and have properly defined ehcahe settings.
Please provide us help ASAP as our perfomance is not getting improved.
[b]Hibernate version: 2.1 [/b]
[b]Mapping documents:[/b]
[b]Code between sessionFactory.openSession() and session.close():[/b]
[b]Full stack trace of any exception that occurs:[/b]
[b]Name and version of the database you are using:[/b]
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]