If I add a new object and go .save() then run a select, the last object created, is retrieved from the classes, rather than the DB, which means a date property hasn’t been converted into SQL format and its mucking up some frontend code of mine.
E.G
Tue Feb 06, 2012 instead of 2012-02-06 00:00:00
Is there a way to make sure all my objects get pulled from database?
Thanks
Hibernate has a few levels of cache. What you are experiencing is the session/first level cache. There is no way to disable that. But you can look into using a StatelessSession http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/batch.html Section 15.3 if you are insistent on doing something like this.
I advice you re-think your separation of User Interface, Business Logic and Persistence Layer if you are relying on the database to return correctly formatted date strings to your users. You shouldn’t care how the Database or Hibernate formarts strings as long as you can understand the data you are storing/retrieving. Look into MVC, MVVM, or any other patterns of separation.