What is LeanXcale?
LeanXcale is an ACID database engine that scales linearly and flexibly from a single node up to hundreds of nodes and boasts a key–value API with single-digit millisecond latency and maintains the same performance for large volumes.
LeanXcale can scale linearly as your business grows; from the MVP to global deployment, also provides a fast and flexible platform with a 360º view of all available information.
Sign up for LeanXcale
LeanXcale provides a trial version without the need to provide any information. You just need to register with your email
here
In few minutes you will receive an email to activate the trial version and it will take you directly to the LeanXcale platform.
What is OpenXava?
OpenXava is a Java open-source framework with high productivity, focused on the development of enterprise web application adaptable to multiplatform and supports practically all relational databases.
Sign up and download OpenXava Studio
OpenXava is free and you can download the Studio sign up
here or you can use another IDE such as IntelliJ, VSC with Maven. once registered, you will receive an email with a link to download the Studio, below we will use this IDE.
Create new OpenXava project
First you have to click on
OpenXava > New OpenXava Project and a window will pop up

Open the
src/main/java folder, there select the
com.yourcompany.invoicing.model package and click on
New Java Class button:

Then type
Customer as class name and press
Finish.

Copy the following code in
Customer:
package com.yourcompany.invoicing.model;
import javax.persistence.*;
import org.openxava.annotations.*;
import lombok.*;
@Entity
@Getter @Setter
public class Customer {
@Id
@Column(length=6)
int number;
@Column(length=50)
@Required
String name;
}
Config OpenXava for LeanXcale
Edit the pom.xml file in the project root folder and add the following dependencies in
<dependencies>:
<dependency>
<groupId>com.leanxcale</groupId>
<artifactId>qe-driver</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>com.leanxcale.connectors</groupId>
<artifactId>hibernate-connector</artifactId>
<version>1.9.4</version>
</dependency>
In the same file, add the following repository in
<repositories>:
<repository>
<id>maven-releases</id>
<url>https://nexus.leanxcale.com/repository/maven-releases</url>
</repository>
It would be something like this:
Would remain to add a property in
persistence.xml located in
src/main/resources/META-INF folder:
<properties>
<!-- ... -->
<property name="hibernate.dialect" value="com.leanxcale.connector.hibernate.LxDialect"/>
<property name="hibernate.globally_quoted_identifiers" value="true"/>
</properties>

Now go to LeanXcale platform, "How To Connect" and copy the url:

Then edit the
context.xml file located in
src/main/webapp/MEFA-INF folder:
<Resource name="jdbc/invoicingDS" auth="Container" type="javax.sql.DataSource"
maxTotal="20" maxIdle="5" maxWaitMillis="10000"
username="app" password="app"
driverClassName="com.leanxcale.client.Driver"
url="jdbc:leanxcale://a5357d898f9318f2a75b.lxc-db.com:1522/db"/>
Obviously, you have to adapt it to your project. change the username, password(if you are using trial version, user/password is "app"), in the url paste the one you copied on the LeanXcale platform.
Rebuild the project
After the changes you have to rebuild your project. In OpenXava Studio click with right mouse button on your project an choose Run As > Maven install, thus:

Optimization note: Instead of a
mvn install, that do a complete Maven
build, you can use
mvn war:exploded, enough to apply the above changes for development. You can run
mvn war:exploded from OpenXava Studio with
Run As > Maven build... and typing
war:exploded for
goal.
Run application
Click on the
Run button:

Wait until the console shows a message saying "Application started", like this:
Then your application is already running. To check this, open your favorite browser (Chrome, Firefox, Edge or Safari) and go to the next URL:
http://localhost:8080/invoicing
You get your application running for the first time. To start click on SIGN IN button
Now, enter admin/admin and click on SIGN IN:
Then on top the left you will have a list of modules, choose
Customers:

Use the
Customers module to create new customers, just enter number and name and press
Save.

Click on
List to see the list of created customers. Congratulations, you have your first OpenXava application running.
Do you like OpenXava and want more details? We invite you to watch lesson 1
Did you have problems with OpenXava? Ask in the forum