All Projects → omnifaces → optimusfaces

omnifaces / optimusfaces

Licence: other
Utility library for OmniFaces + PrimeFaces combined

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to optimusfaces

jsf-primefaces
JSF Primefaces Tutorials
Stars: ✭ 93 (+158.33%)
Mutual labels:  jsf, primefaces
Defterp
deftERP - Jakarta EE (Java EE 7 : JSF, JPA, EJB, CDI, Bean Validation)
Stars: ✭ 207 (+475%)
Mutual labels:  jpa, jsf
Javaee7 Petclinic
Java EE 7 Petclinic
Stars: ✭ 31 (-13.89%)
Mutual labels:  jpa, jsf
primestrap
JSF, PrimeFaces and Bootstrap Integration
Stars: ✭ 33 (-8.33%)
Mutual labels:  jsf, primefaces
morn-boot-projects
基于SpringBoot的JavaWeb开发框架,致力于为JavaWeb项目提供标准化API。
Stars: ✭ 31 (-13.89%)
Mutual labels:  jpa
migrate-Java-EE-app-to-azure
Migrate an existing Java EE workload to Azure
Stars: ✭ 12 (-66.67%)
Mutual labels:  jpa
betca-spring
BETCA (Spring). Back-end con Tecnologías de Código Abierto, versión Java-Spring
Stars: ✭ 27 (-25%)
Mutual labels:  jpa
spring-boot-examples
本仓库为《Spring Boot 系列文章》代码仓库,欢迎点赞、收藏。
Stars: ✭ 52 (+44.44%)
Mutual labels:  jpa
javaee8-cookbook
Jakarta EE 8 Cookbook (second edition)
Stars: ✭ 40 (+11.11%)
Mutual labels:  jsf
spring-boot-jpa
A Spring Boot microservices reference application using Spring Data JPA
Stars: ✭ 25 (-30.56%)
Mutual labels:  jpa
spring-boot-data-jpa-mysql
Spring Boot Rest CRUD API example - Spring Data JPA to interact with MySQL/PostgreSQL database.
Stars: ✭ 89 (+147.22%)
Mutual labels:  jpa
spring-boot-java-swing-reservations
The project aims to present how to connect Spring Boot 2 and Java Swing GUI widget toolkit. All application dependencies are provided by Docker Compose. There are also static code analysis tools like FindBugs and Checkstyle.
Stars: ✭ 86 (+138.89%)
Mutual labels:  jpa
jpa-manytomany-extracolumns-springboot-maven-mysql
JPA Many-To-Many Extra Columns Relationship Mapping Example with Spring Boot, Maven and MySQL
Stars: ✭ 15 (-58.33%)
Mutual labels:  jpa
springboot-chapter
🚀Spring Boot 2.0基础教程。主流框架整合,实践学习案例。
Stars: ✭ 23 (-36.11%)
Mutual labels:  jpa
jsf
Creates fake JSON files from a JSON schema
Stars: ✭ 46 (+27.78%)
Mutual labels:  jsf
LazyREST
基于Sping全家桶实现的极速产出RESTful类接口脚手架
Stars: ✭ 21 (-41.67%)
Mutual labels:  jpa
primefaces-selenium
PrimeFaces testing support for Selenium
Stars: ✭ 16 (-55.56%)
Mutual labels:  primefaces
Smart-Contract-Verifier
This project is to create a system that uses DeFi technology to enforce contracts. Users will be able to set up contracts between each other, this includes an escrow service for payments. If users disagree over whether a contract was fulfilled, a jury appointed by the system will make the final decision.
Stars: ✭ 16 (-55.56%)
Mutual labels:  jpa
active-persistence
Active Persistence is a implementation of Active Record Query Interface for JPA that makes it easy and fun.
Stars: ✭ 14 (-61.11%)
Mutual labels:  jpa
SimpleCurd
2个类,实现类ActiveRecord,无需写Mapper, mybatis增强
Stars: ✭ 14 (-61.11%)
Mutual labels:  jpa

Maven Javadoc Tests License

OptimusFaces

Utility library for OmniFaces + PrimeFaces combined.

This project is currently still in development stage!

This project basically combines best of OmniFaces and PrimeFaces with help of OmniPersistence, an utility library for JPA. This project should make it a breeze to create semi-dynamic lazy-loaded, searchable, sortable and filterable <p:dataTable> based on a JPA model and a generic entity service.

Installation

pom.xml

<dependencies>
    <!-- Target Java EE server. -->
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>8.0</version><!-- Minimum supported version is 7.0 -->
        <scope>provided</scope>
    </dependency>

    <!-- Runtime dependencies. -->
    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>3.6</version><!-- Minimum supported version is 2.2 -->
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>8.0</version><!-- Minimum supported version is 7.0 -->
    </dependency>
    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>optimusfaces</artifactId>
        <version>0.12</version>
    </dependency>
</dependencies>

Basic Usage

First create your entity service extending org.omnifaces.omnipersistence.service.BaseEntityService. You don't necessarily need to add new methods, just extending it is sufficient. It's useful for other generic things too.

@Stateless
public class YourEntityService extends BaseEntityService<Long, YourEntity> {

   // ...

}

And make sure YourEntity extends org.omnifaces.omnipersistence.model.BaseEntity or one of its subclasses GeneratedIdEntity, TimestampedEntity, TimestampedBaseEntity, VersionedEntity or VersionedBaseEntity.

@Entity
public class YourEntity extends BaseEntity<Long> {

    @Id @GeneratedValue(strategy=IDENTITY)
    private Long id;
    private Instant created;
    private String name;
    private Type type;
    private boolean deleted;

    // ...
}

Then create a org.omnifaces.optimusfaces.model.PagedDataModel in your backing bean as below.

@Named
@ViewScoped
public class YourBackingBean implements Serializable {

    private PagedDataModel<YourEntity> model;

    @Inject
    private YourEntityService service;
    
    @PostConstruct
    public void init() {
        model = PagedDataModel.lazy(service).build();
    }

    public PagedDataModel<YourEntity> getModel() {
        return model;
    }

}

Finally use <op:dataTable> to have a semi-dynamic lazy-loaded, pageable, sortable and filterable <p:dataTable> without much hassle.

<... xmlns:op="http://omnifaces.org/optimusfaces">

<h:form id="yourEntitiesForm">
    <op:dataTable id="yourEntitiesTable" value="#{yourBackingBean.model}">
        <op:column field="id" />
        <op:column field="created" />
        <op:column field="name" />
        <op:column field="type" />
        <op:column field="deleted" />
    </op:dataTable>
</h:form>

The field attribute of <op:column> represents the entity property path. This will in turn be used in id, field, headerText and filterBy attributes of <p:column>.

Here's how it looks like with default PrimeFaces UI and all. This example uses exactly the above Java and XHTML code with a Person entity with Long id, String email, Gender gender and LocalDate dateOfBirth fields.

example of op:dataTable

Advanced Usage

Check PagedDataModel javadoc.

Known Issues

  • EclipseLink refuses to perform a JOIN with Criteria API when setFirstResult/setMaxResults is used. This returns a cartesian product. This has been workarounded, but this removes the ability to perform sorting on a column referenced by a join (@OneToMany and @ElementCollection). You should set such columns as <op:column ... sortable="false">. Another consequence is that you cannot search with a multi-valued criteria in a field referenced by a @OneToMany relationship. You should consider using a DTO instead.
  • OpenJPA adds internally a second JOIN when sorting a column referenced by a join (@OneToMany and @ElementCollection). This has as consequence that the sorting is performed on a different join than the one referenced in GROUP BY and will thus be off from what's presented. You should for now set such columns as <op:column ... sortable="false"> or consider using a DTO instead.
  • OpenJPA does not correctly apply setFirstResult/setMaxResults when an @OneToMany relationship is involved in the query. It will basically apply it on the results of the @OneToMany relationship instead of on the query root, causing the page to contain fewer records than expected. There is no clear solution/workaround for that yet.

The integration tests currently run on following environments:

  • WildFly 19.0.0 with Mojarra 2.3.9 and Hibernate 5.3.15
  • WildFly 19.0.0 with Mojarra 2.3.9 and EclipseLink 2.7.6
  • Payara 5.201 with Mojarra 2.3.14 and Hibernate 5.4.12
  • Payara 5.201 with Mojarra 2.3.14 and EclipseLink 2.7.4
  • TomEE 8.0.1 with MyFaces 2.3.6 and OpenJPA 3.1.0

Each environment will run the IT on following databases:

  • H2 1.4.197 on WildFly and H2 1.4.200 on Payara and TomEE (embedded database)
  • MySQL 5.7.29 (provided by Travis) with JDBC driver 8.0.19
  • PostgreSQL 9.6.17 (provided by Travis) with JDBC driver 42.2.11

Effectively, there are thus 15 full test runs of each 31 test cases on 19 XHTML files.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].