We have a tool named LatticeFramework Studio let you connect to MySQL, then you can extract database metadata in xml file and generate Java code using xslt style sheets. It also have a sql editor with code completion.

LatticeFramework Studio supports SQL Server, Oracle, MySQL and PostgreSQL and can generate code in Java, C#, VB.NET, PHP and more.

Below is the link: