Commit d10c5251 by Bogdan Andjelkovic

Merge remote-tracking branch 'origin/master'

parents 12b14a2e e3942b49
......@@ -81,4 +81,42 @@ public class KomentarRepository {
throw new RuntimeException(e);
}
}
public double averageOcenaByOglasId(int oglasId)
{
String sql = "{call averageOcenaByOglasId(?)}";
ResultSet rs=null;
CallableStatement stmt = null;
try {
stmt = dataBase.connection.prepareCall(sql);
stmt.setInt(1,oglasId);
rs=stmt.executeQuery();
while(rs.next())
{
return rs.getDouble(1);
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
return 0;
}
public double averageOcenaByKorisnikId(int korisnikId)
{
String sql = "{call averageOcenaByKorisnikId(?)}";
ResultSet rs=null;
CallableStatement stmt = null;
try {
stmt = dataBase.connection.prepareCall(sql);
stmt.setInt(1,korisnikId);
rs=stmt.executeQuery();
while(rs.next())
{
return rs.getDouble(1);
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
return 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment