Pregunta

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.

¿Fue útil?

Solución

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)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top