문제

In Play 2.0m I have a static method in my model to wrap searching the DB:

public static User findUserByEmail(String email) {
    Finder<String, User> find = new Finder<String, User>(String.class, User.class);
    return find.where().eq("email", email).findUnique();
}

Is this threadsafe? I saw How Playframework 1.x static method works in a thread safe way but I don't know if that applies to the models too.

도움이 되었습니까?

해결책

Your method is thread-safe since you're only reading from the DB.
(and even if you were writing, I'm sure your DB can handle concurrent writes)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top