db to java

and improve the db design