Whats the solution? Just append an & at the end of the command.
Eg: For running hsql db as a service, am using the below command
java -cp ../hsqldb/lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:appcache --dbname.0 appcachedb &
Now go ahead and close you ssh console. You will see that your db server is still running.
If you have a better way of doing this, do let me know.