Improving the OFBiz User Interface with JPA

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Improving the OFBiz User Interface with JPA

ofbiz-3
Hi all,

as I announced recently with the email "OFBiz Delegator that uses JPA",
I am working now on a drop in replacement that uses JPA as entity model.
While the work on the replacement is still in progress, a JAR with the
JPA entities has reached a beta state. It can be downloaded from here
(about 6MB, source code included):

http://www.mk-multimedia.de/ofbiz/ofbiz-entity-jpa.jar

Because JPA (and J2EE) does not only offer a standard replacement for
the database layer but can also improve and accelerate the development
of the presentation layer, I like to suggest to consider using (de
facto) standard libraries like PrimeFaces
(http://www.primefaces.org/showcase/) for improving the UI.

For those of you who are not aware about the power of JPA in an IDE,
here is a little tutorial:



Install NetBeans with J2EE-Support
==================================

1. Download NetBeans J2EE Bundle:
        https://netbeans.org/downloads/
2. Install NetBeans and Glassfish:
        https://netbeans.org/community/releases/82/install.html


Setup Glassfish
===============

1. Start NetBeans
2. Klick on the "Services" tab, right click on "Servers" -> add
3. Select "GlassFish Server" and enter a name
4. Set the installation location and choose "Local Domain"
5. Choose a domain location and ports (watch out for conflicts with
OFBiz ports!)


Create a database connection, connection pool and JDBC resource
===============================================================

IMPORTANT: My JPA library expects a JDBC resource with the JNDI name
"jdbc/ofbiz" (specified in "/META-INF/persistence.xml")!

-> https://netbeans.org/kb/docs/javaee/ecommerce/setup.html


Create a Web-Application
========================

1. File -> New Project
2. Choose the following Project:
        Categories: Java Web
        Projects: Web Application
3. Enter the Project Name, e.g. "OFBiz-UI"
4. Choose the Server Settings:
        Server: Choose the installed one
        Java EE Version: Has to be "Java EE 7 Web"
        Context-Path: The absolute path of the OFBiz-UI URL
5. Select the framework:
        a) Choose JavaServer Faces
        b) Click on "Components" tab and select "PrimeFaces"


Create a UI for an entity
=========================

1. Download the JAR with the JPA entities:
        http://www.mk-multimedia.de/ofbiz/ofbiz-entity-jpa.jar
2. Add the JAR to the libraries of the Web-Application
3. Right click on the Web-Application -> New -> Other:
        Categories: Persistence
        File Types: JSF Pages from Entity Classes
4. Choose only one entity Class, e.g.
"org.apache.ofbiz.party.party.Party", click "Add >" and disable "Include
Referenced Classes"
5. Choose packages, folders and templates:
        Session Bean Package: org.apache.ofbiz.party.ejb
        JSF Classes Package: org.apache.ofbiz.party.jsf
        JSF Pages Folder: /
        Localization Bundle Name: /org/apache/ofbiz/party/PartyBundle
        Choose Template: PrimeFaces
6. Choose Provider and Database (as specified in
"/META-INF/persistence.xml"):
        Persistence Unit Name: org.apache.ofbiz
        Data Source: jdbc/ofbiz
7. Right click on the Web-Application -> Run


Improvements:
=============

- Use Payara instead of Glassfish because it is much more reliable
   -> http://www.payara.fish/downloads

- Use PrimeFaces 6.0 community release
   -> http://www.primefaces.org/downloads

- Use PrimeFaces community theme
   -> http://www.primefaces.org/themes


Greetings

Markus Küspert
Reply | Threaded
Open this post in threaded view
|

Re: Improving the OFBiz User Interface with JPA

James Yong-2
Hi Markus,

I have checked out the contents of the jar file and the entity beans look comprehensive.

If you are still working on this, can you provide a minimum patch to OFBiz trunk version so that we can test them out in stages.

Personally, I am in favor of adopting JPA and agree it will be good for OFBiz.

Regards,
James Yong

On 2016-12-15 02:52 (+0800), [hidden email] wrote:

> Hi all,
>
> as I announced recently with the email "OFBiz Delegator that uses JPA",
> I am working now on a drop in replacement that uses JPA as entity model.
> While the work on the replacement is still in progress, a JAR with the
> JPA entities has reached a beta state. It can be downloaded from here
> (about 6MB, source code included):
>
> http://www.mk-multimedia.de/ofbiz/ofbiz-entity-jpa.jar
>
> Because JPA (and J2EE) does not only offer a standard replacement for
> the database layer but can also improve and accelerate the development
> of the presentation layer, I like to suggest to consider using (de
> facto) standard libraries like PrimeFaces
> (http://www.primefaces.org/showcase/) for improving the UI.
>
> For those of you who are not aware about the power of JPA in an IDE,
> here is a little tutorial:
>
>
>
> Install NetBeans with J2EE-Support
> ==================================
>
> 1. Download NetBeans J2EE Bundle:
> https://netbeans.org/downloads/
> 2. Install NetBeans and Glassfish:
> https://netbeans.org/community/releases/82/install.html
>
>
> Setup Glassfish
> ===============
>
> 1. Start NetBeans
> 2. Klick on the "Services" tab, right click on "Servers" -> add
> 3. Select "GlassFish Server" and enter a name
> 4. Set the installation location and choose "Local Domain"
> 5. Choose a domain location and ports (watch out for conflicts with
> OFBiz ports!)
>
>
> Create a database connection, connection pool and JDBC resource
> ===============================================================
>
> IMPORTANT: My JPA library expects a JDBC resource with the JNDI name
> "jdbc/ofbiz" (specified in "/META-INF/persistence.xml")!
>
> -> https://netbeans.org/kb/docs/javaee/ecommerce/setup.html
>
>
> Create a Web-Application
> ========================
>
> 1. File -> New Project
> 2. Choose the following Project:
> Categories: Java Web
> Projects: Web Application
> 3. Enter the Project Name, e.g. "OFBiz-UI"
> 4. Choose the Server Settings:
> Server: Choose the installed one
> Java EE Version: Has to be "Java EE 7 Web"
> Context-Path: The absolute path of the OFBiz-UI URL
> 5. Select the framework:
> a) Choose JavaServer Faces
> b) Click on "Components" tab and select "PrimeFaces"
>
>
> Create a UI for an entity
> =========================
>
> 1. Download the JAR with the JPA entities:
> http://www.mk-multimedia.de/ofbiz/ofbiz-entity-jpa.jar
> 2. Add the JAR to the libraries of the Web-Application
> 3. Right click on the Web-Application -> New -> Other:
> Categories: Persistence
> File Types: JSF Pages from Entity Classes
> 4. Choose only one entity Class, e.g.
> "org.apache.ofbiz.party.party.Party", click "Add >" and disable "Include
> Referenced Classes"
> 5. Choose packages, folders and templates:
> Session Bean Package: org.apache.ofbiz.party.ejb
> JSF Classes Package: org.apache.ofbiz.party.jsf
> JSF Pages Folder: /
> Localization Bundle Name: /org/apache/ofbiz/party/PartyBundle
> Choose Template: PrimeFaces
> 6. Choose Provider and Database (as specified in
> "/META-INF/persistence.xml"):
> Persistence Unit Name: org.apache.ofbiz
> Data Source: jdbc/ofbiz
> 7. Right click on the Web-Application -> Run
>
>
> Improvements:
> =============
>
> - Use Payara instead of Glassfish because it is much more reliable
>    -> http://www.payara.fish/downloads
>
> - Use PrimeFaces 6.0 community release
>    -> http://www.primefaces.org/downloads
>
> - Use PrimeFaces community theme
>    -> http://www.primefaces.org/themes
>
>
> Greetings
>
> Markus K�spert
>
Reply | Threaded
Open this post in threaded view
|

Re: Improving the OFBiz User Interface with JPA

Victor Hernadez
In reply to this post by ofbiz-3
Makus,

I'm working with 2 peers on a new project based on OFBiz to create a custom app capable to interact with OFBiz db using Spring Framework + Angular 2. We just started from scratch building our own ORM (Hibernate based) implementation for OFBiz but now I found you already did a really great work hence now I wonder if your are maintaining an updated repository which we could use, test and help to you improving it instead of continue our own implementation.

Thanks,
Victor