Joget DX Preview Release Available for Download

Check out Joget DX, the next generation successor to Joget Workflow for faster, simpler digital transformation.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

Sometime, you may want to have your own Hibernate entity and dao to access extra database table in your plugin. It is very simple to achieve that by adding the following file and class to your plugin.

Similar to development in Spring + Hibernate, a application context file is required for your plugin. In my sample plugin, I created a productsApplicationContext.xml as below

In the application context, I created 2 beans. Bean "productSessionFactory" is to initialize a session factory with the hibernate mapping file. Bean "productsDao" is to initialize the dao object of my sample plugin.

Next, we need a Hibernate Mapping file. In my sample plugin, it is /org/joget/sample/products/model/Products.hbm.xml. It mapped the POJO "org.joget.products.model.Product" with "valu_products" table.

You need a utility class to initialized your application context and allow you to retrieve the bean object.

 

You need to orverride findSession method in  ProductsDaoImpl as compared to joget version 4.

 

After you implemented your POJO and dao class, you should be able to use your dao in your plugin as following. Please refer to the attached sample plugin for POJO and dao implementation.

In this KB:sample plugin, you are able to add, delete and list product by the following JSON API.

To add,

To delete,

To list all products,

  • No labels