Jump to content
We've recently updated our Privacy Statement, available here ×

andrew_s

Members
  • Posts

    1
  • Joined

  • Last visited

andrew_s's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. In the HibernateAccessTest.java source there is a method called testUserQuery(). It creates a user (TestUser), assigns roles for him and then it reads this user back to make sure it was created. For postgresql find method returns 0 records. The problem is a query buffering that hibernate makes, i.e. when you create an object, INSERT query does not get executed right away. But find relies on what is in DB already. Later on, buffer gets flushed, and you can see the user in db, which is even more confusing. The fix is: Code: createUser(); createRoles(); template.flush();// <-- here System.out.println("testUserQuery"«»); List result = template.find("from RepoUser where username = ?", "TestUser"«»); It does not happen with MySQL, I have not figured out why.. Post edited by: andrew_s, at: 2007/04/11 21:48
×
×
  • Create New...