queries

Typesafe queries for TopLink

Is there any other way to do typesafe queries with TopLink than through the JPA 2.0 Criteria API? From a sales meeting I got the impression that this is possible through a proprietary part in TopLink, but I couldn't find any related documentation. ...

Reduce database I/O ops.

Am I correct in thinking that for a database with n USERS, the following code results in at least n interations with the database? Statement stmt = con.createStatement(); ResultSet srs = stmt.executeQuery( "SELECT FAVOURITE_COLOR FROM USERS"); while (srs.next()) { //performSomeAction on srs.getString("FAVOURITE_COLOR"); } ...

is it okay if i put all my db queries in one file?

i have function file called models.php, which stores all my database functions, for example // get the updates for the $user_id profile function getProfileUpdates($user_id) { $query="SELECT m . * , u.picture, u.username FROM notes m, user u WHERE m.user_id = u.user_id AND u.user_id ='$user_id' ...

Using JSON to ask Google Maps for a Shop

Hi to all. I am using the JSON iPhone framework v2.3.1, and I want to query Google Maps about shops, hotels, etc. It is possible to create an URL direction that gives me a list of directions? Actually I am using this Objective C code. - (void) searchCoordinatesForAddress { //Build the string to Query Google Maps. //I don't kn...

SQL database queries basic question AVG Difference

I have a really basic question on SQL. Relational Schema: Student (Sid, Sname ) Class (Sid, ClassName, mark) ClassName = { MATH, ENGLISH, PHY, .......} I want to list out all the student who have taken MATH, and their MATH class average minus the student's math mark Select DINSTINCT S.Sname, (E.Mark - AVG (E.Mark)) From Student ...