Moved all query related stuff to ejb
Merge remote-tracking branch 'angrychuy/master'