In general I want to know how SQL select is implemented in the lower level, it looks like
the algorithm they using is close to O(1)..... in Java you can only achieve this by using
hashmaps, I wander how they did it
EXAMPLE:
If I have a group of student, and group of classes, in order to select any of student belongs to which classes
or any class holds which group of students, I would design a relational database, which 3 tables :
student table, class table, relation table
which should represent a good many-to-many relationship
however if I don't want to use SQL , JDBC, create and design the tables
how can I implement this in pure java
I would like something like
List<Student> getStudentsByClass(String className)
or
List<Class> getClassesByStudent(String StudentName)
Ideally I will have a hashMap using unique studentID as key and the actual studentObject as value and another hasMap uing classID as key and classObject as value
then a relation ArrayList holds all the relation objects, inside the relation object you have 2 files, the classID and studentID
the problem is I don't want to loop through the relation ArrayList everytime when I doing a search
I know there is a compare method on object which I can override by that only helps you to sort the obejcts it doesn't help much with select isn't?
there is a link, I understand everything, but not the selecting bit, any one any tips please!
http://www.javaworld.com/javaworld/jw-11-2004/jw-1122-select.html?page=3