问题
I am creating a webapp with EclipseLink for the persistence layer, and I have a DAO that is hanging when I attempt to load an object.
The application/code has previously worked when loaded in to other machines/IDEs, but I have just loaded it into Eclipse Indigo on a Windows 7 machine and this error has started occuring (there are no compile errors/warnings in the code etc, and the app builds/starts fine).
The DAO method is as follows:
public Account loadAccountByUserName(String userName)
{
Query query = getEntityManager().createQuery("select u from Account u where u.userName = :userName")
.setParameter("userName", userName);
return (Account) query.getSingleResult();
Now I have debugged the code, and walked through it, and once I execute the createQuery(..) line it just hangs. There are no errors, nothing logged, it just hangs (apparently indefinitely).
Any ideas?
回答1:
Wow, Ok. It was just straight up slow..
Its running SpringMVC/EclipseLink app on Eclipse Indigo on a pretty new Win7 machine, connecting to a DB2 local database and it takes about 15minutes to make the first connection (following loads of data seem a lot quicker) - it just seems to be about making the connection too, as its just a user look up, and there isnt much user data in the tables.
来源:https://stackoverflow.com/questions/9914271/entiymanager-createquery-hangs