001    /*
002    @license.text@
003     */
004    package biz.hammurapi.sql;
005    
006    import java.sql.Connection;
007    import java.sql.SQLException;
008    
009    import biz.hammurapi.sql.IdentityRetriever;
010    import biz.hammurapi.sql.SQLProcessor;
011    
012    /**
013     * Retrieves identity by executing SQL statement
014     * @author Pavel Vlasov
015     * @revision $Revision$
016     */
017    public class GenericIdentityRetriever implements IdentityRetriever {
018            
019            private String sql;
020    
021            public GenericIdentityRetriever(String sql) {
022                    this.sql=sql;
023            }
024    
025            public int retrieve(Connection con) throws SQLException {
026                    return new SQLProcessor(con, null).projectSingleInt(sql, null);
027            }
028    
029    }