GWT Database
In this tutorial, we will setup database connectivity using GWT. We can use Eclipse to configure database.
Eclipse consists of HSQLDB plugin which can be installed. Plugin makes installation easy to set up. Plugin provides many features such as start/stop db, invokes database manager GUI. Here, the following steps are of configuration.
- Select Help → Eclipse MarketPlace search keyword HSQLDB and click install button.
- Now, choose Window → Show View → Others and in Show View dialog expand HSQL Database server and select HSQLDB Server to open the HSQLDB view.
- Click on View Menu and select Preferences from the drop down menu. Enter values shown in the Figure.
- Start the database and open database manager by selecting Show database Client from drop down menu.
Load Database
We use RStore to load data it has following features:
- It enhances java classes for persistence.
- It creates database schema.
- It deletes database schema.
- It persists and retrieves objects from database.
Dependencies
RStore requires HSQLDB, Data Nucleus JDO, MyBatis and Hibernate libraries. Following table lists the dependencies.
Common |
JDO |
Hibernate |
MyBatis |
hsqldb-2.2.9.jar |
jdo-api-3.0.1.jar |
hibernate-commons-annotations-4.0.1.Final.jar |
mybatis-3.2.0.jar |
commons-lang-2.6.jar |
datanucleus-api-jdo-3.1.3.jar |
hibernate-core-4.1.10.Final.jar |
|
log4j-1.2.16.jar |
datanucleus-core-3.1.4.jar |
hibernate-jpa-2.0-api-1.0.1.Final.jar |
|
|
datanucleus-rdbms-3.1.4.jar |
jboss-logging-3.1.0.GA.jar |
|
|
datanucleus-enhancer-3.1.1.jar |
jboss-transaction-api_1.1_spec-1.0.0.Final.jar |
|
|
asm-4.0.jar |
antlr-2.7.7.jar |
|
|
|
dom4j-1.6.1.jar |
|
|
|
javassist-3.15.0-GA.jar |
|
Download: To download above files here are the links:
Common: hsqldb , Common-lang , log4j .
JDO: datanucleus , showfiles , jdo .
Hibernate: hibernate .
MyBatis: mybatis .
Implementation
Adding Mysql configuration to GWT
LoginScreen.gwt.xml
Database Connection
DBConnection.java
DBConnectionAsync.java
User.java (Frontend designing)
MySQLConnection.java (Creating Servlet)
Output
|