You can host your custom Java web application with database on your own domain completely for free on Heroku or OpenShift. I have several websites running this way (including this one) up and running for over a year now and I think I gathered enough experience to write a comparison. Note: OpenShift will have soon (june 2015) big upgrade, which might solve some issues.
UPDATE: 7.5.2015 Heroku announced that from July 2015 their free hosting will be severely restricted and practically unusable (idling each 30 minuts and application will have uptime only 18 hours - which means 6 hours mandatory downtime ... which completely destroys their free hosting)
|Number of web. apps||
||3 applications per account.|
|Boot Timeout||Application must start within 60 seconds, otherwise Heroku will kill it. This is especially troublesome when using Spring (Spring singletons are created upon application startup) and when creating database tables based on entites with Hibernate (that's also done upon application startup).||
|Idling||If the application doesn't receive request for 1 hour, it will be idled (server will stop). When idled application receives a request, it will start running again. Idling causes severe timeout.||
|Latest Java Version||
||Java 7 (older version, currently even EOL - End Of Life)|
|Files||You cannot store anything on filesystem, just temporary files which are garanteed to last only during single request.||
|Upload web. application||
|Custom WAR file||Short answer: no, long answer: currently it's deprecated and doesn't have to work in the future.||
|Uptime||Heroku will automatically restart your application each day (this will cause annoying timeout)||
||Not much addons (32 addons).|
||You have to do almost everything from command line.|
So should you use Heroku or OpenShift? There's no clear winner, I guess it depends on your web application and requirements.
Made better & faster using https://www.yourkit.com/ Java Profiler