DAO method retrieve single entry

Posted by London on Stack Overflow See other posts from Stack Overflow or by London
Published on 2010-05-20T11:12:09Z Indexed on 2010/05/20 11:20 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

Hello,

How can I write DAO method which will return as a result only first entry from the database. For instance lets say I'm looking at Users table and I want to retrieve only the first entry, I'd declare method like:

public User getFirstUser(){
    //method logic
}

EDIT:

User has primary key id if that matters at all.

I apologize if this question is too simple/stupid/whatever I'm beginner with Java so I'm trying new things. thank you

© Stack Overflow or respective owner

Related posts about java

Related posts about dao