Vaadin JPAContainer
Binds Vaadin user interface components directly to your JPA entities. Use Criteria API to modify database queries and automatically created fields for referenced entities.
Note, this add-on is depracated. Version 4.0.0, compatible with Vaadin Framework 8.0.0, is only built to make it easier to upgrade to Vaadin 8 using compatibility packages. The new version only changed relevant imports into v7 compatibility package. Users are encouraged to move to more modern Vaadin 8 APIs.
Vaadin JPAContainer allows connecting Vaadin user interface components directly to the persistent model objects. It is an implementation of the container interface defined in the Vaadin core framework. You can use JPAContainer to display data in a table, tree, any other selection component, or edit the data in a form. JPAContainer uses 3rd party JPA 2.0 (JSR-317) standard supporting Object-Relational Mapping (ORM) libraries, such as EclipseLink or Hibernate, for storing and retrieving data from database.
Vaadin JPAContainer suits well for trivial listings of one Entity. In most cases JPA should though be used with Vaadin through a service layer and entities should be bound to components like any other Java objects, with for example BeanItemContainer. For lazy loading solutions with this kind of architecture, there are excellent community contributed add-ons like Viritin and LazyQueryContainer, which are often used instead of JPAContainer by projects built here at Vaadin Ltd as well.
Vaadin JPAContainer 2.0 supports the most common features required by Java EE applications out of the box, such as lazy loading, advanced filtering, nested property names and caching. JPAContainer utility classes makes writing CRUD functionality to your application fast and easy. E.g. use automatically created selects or “master-detail views” for ManyToOne or OneToMany relations.
In case you are still using JPA 1.0 implementation you should use older version of JPAContainer which can be downloaded by selecting 1.2.x version from Version drop-down list.
Note, some new features of the add-on (like the FieldFactory) requires Vaadin 6.7.3 or later.
Sample code
JPAContainer<Person> container = JPAContainerFactory.make(Person.class, "addressbook"); Table table = new Table("Persons", container);
/** * Example entity. When bound to a Form with FieldFactory from JPAContainer * add-on: * * - customer will be edited a select of customers backed by JPAContainer * listing Customer entities * * - rows will be edited with a Table based "master-detail editor" backed up * JPAContainer listing InvoiceRows related to this entity * * - billingAddress will be edited with a sub form * * See related screenshot for the result * */ @Entity public class Invoice { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Temporal(TemporalType.TIMESTAMP) private Date date; @ManyToOne private Customer customer; @OneToMany(mappedBy="invoice") private List<InvoiceRow> rows; @OneToOne private BillingAddress billingAddress; // getters and setters omitted } Form form = new Form(); // use the FieldFactory helper class from JPAContainer Add-On FieldFactory jpaContainerFieldFactory = new FieldFactory(); form.setFormFieldFactory(jpaContainerFieldFactory); // set item to form from a JPAContainer instance form.setItemDataSource(jpaContainer.getItem(itemId);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Only change from 3.2 is that 4.0 uses v7 compatibility package for imports, making it easier to migrate to Vaadin 8.
- Released
- 2017-03-02
- Maturity
- CERTIFIED
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 8.0+
- Vaadin 7.2+ in 3.2.0
- Vaadin 7.1+ in 3.1.0
- Vaadin 6.8+ in 2.2.0
- Vaadin 7.0+ in 3.0.0
- Vaadin 6.7+ in 2.1.0
- Vaadin 6.6+ in 1.2.1
- Vaadin 6.0+ in 1.0.5
- Vaadin 6.2+ in 1.0.4
- Browser
- Browser Independent
Grid Exporter Add-on - Vaadin Add-on Directory
Extension for exporting Vaadin's grid data to common formatsOnline Demo
Issue tracker
View on GitHub
Grid Exporter Add-on version 1.0.1
Initial Vaadin Directory Release. More info: https://github.com/FlowingCode/GridExporterAddon/releases
Grid Exporter Add-on version 1.1.0
### Bugfixes & Enhancements
* Add support for custom null value handler ([#9](https://github.com/FlowingCode/GridExporterAddon/issues/9))
* Add proper handling of missing optional placeholders ([#3](https://github.com/FlowingCode/GridExporterAddon/issues/3) and [#4](https://github.com/FlowingCode/GridExporterAddon/issues/4))
* Add support for BasicRenderers such as LocalDateRenderer ([#11](https://github.com/FlowingCode/GridExporterAddon/issues/11))
* Add support for auto width in excel columns ([#12](https://github.com/FlowingCode/GridExporterAddon/issues/12))
Grid Exporter Add-on version 1.2.0
#### New features:
* Add the possibility to align the export buttons to the left ([#18](https://github.com/FlowingCode/GridExporterAddon/issues/18))
Grid Exporter Add-on version 1.2.1
### Bugfixes:
* Fix NPE when the grid to export does not contain a footer row (Fixes [#20](https://github.com/FlowingCode/GridExporterAddon/issues/20))
Grid Exporter Add-on version 1.3.0
### New Features
* Implement cell alignment based on grid's column text alignment
* Excel native datatype for numbers and dates support
### Bugfixes
* Fixed issue when exporting to PDF or Docx: the first row was exported correctly, but from the second onwards all rows were sorted in descending order ([#28](https://github.com/FlowingCode/GridExporterAddon/issues/28))
Grid Exporter Add-on version 1.4.0
#### New features:
* upgrade font-awesome-iron-iconset to version 4.2.0 ([#37](https://github.com/FlowingCode/GridExporterAddon/issues/37))
* update poi to version 5.2.3
* docs: clarify that the exporter has to be created before attaching the grid ([#8](https://github.com/FlowingCode/GridExporterAddon/issues/8))
* add support for component based headers ([#33](https://github.com/FlowingCode/GridExporterAddon/issues/33))
* upgrade error-window-vaadin to version 3.4.0
* upgrade grid-helpers to version 0.3.3
Grid Exporter Add-on version 1.4.1
#### Bug fixes:
* check if grid has footer on csv export ([#46](https://github.com/FlowingCode/GridExporterAddon/issues/46))
* extract Grid data in main thread to avoid UI locking issues ([#45](https://github.com/FlowingCode/GridExporterAddon/issues/45))
Grid Exporter Add-on version 1.5.0
#### New features:
* Allow setting columns position in exported file ([#52](https://github.com/FlowingCode/GridExporterAddon/issues/52))
#### Bug fixes:
* Fix ClassCastException when exporting ([#54](https://github.com/FlowingCode/GridExporterAddon/issues/54))
Grid Exporter Add-on version 1.6.0
#### Bug fixes:
* upgrade grid-helpers to 1.1.1 ([#67](https://github.com/FlowingCode/GridExporterAddon/issues/67))
* remove use of reflection
* add missing parameter to query ([#70](https://github.com/FlowingCode/GridExporterAddon/issues/70))
Grid Exporter Add-on version 2.0.0
#### Bug fixes:
* use Vaadin 24 API ([#51](https://github.com/FlowingCode/GridExporterAddon/issues/51))
* upgrade grid-helpers to 1.1.1 ([#67](https://github.com/FlowingCode/GridExporterAddon/issues/67))
* remove use of reflection
* add missing parameter to query ([#70](https://github.com/FlowingCode/GridExporterAddon/issues/70))
Grid Exporter Add-on version 1.7.0
#### Bug fixes:
* Set a default value for excelFormat if it's null ([#73](https://github.com/FlowingCode/GridExporterAddon/issues/73))
* Allow setExportValue to supply other types not just Strings ([#74](https://github.com/FlowingCode/GridExporterAddon/issues/74))
Grid Exporter Add-on version 2.1.0
#### New features:
* support hierarchical dataprovider
* apply conditional formatting in excel export
* allow setExportValue to supply other types not just Strings ([#74](https://github.com/FlowingCode/GridExporterAddon/issues/74))
#### Bug fixes:
* set a default value for excelFormat if it's null ([#73](https://github.com/FlowingCode/GridExporterAddon/issues/73))
Grid Exporter Add-on version 1.8.0
#### New features:
* Support hierarchical dataprovider
* Apply conditional formatting in excel export
Grid Exporter Add-on version 2.1.1
#### Bug fixes:
* Fix bad performance issue on huge grids ([#82](https://github.com/FlowingCode/GridExporterAddon/issues/82))
Grid Exporter Add-on version 2.2.0
#### Bug fixes:
* Fix missing last row when exporting Excel file ([#85](https://github.com/FlowingCode/GridExporterAddon/issues/85))
#### New features:
* Add support to add components to footer toolbar ([#81](https://github.com/FlowingCode/GridExporterAddon/issues/81))
Grid Exporter Add-on version 2.2.1
#### Bug fixes:
- Fix to reuse cell style ([#87](https://github.com/FlowingCode/GridExporterAddon/issues/87))
Grid Exporter Add-on version 1.8.1
#### Bug fixes:
* Fix bad performance issue on huge grids ([#82](https://github.com/FlowingCode/GridExporterAddon/issues/82))
* Fix missing last row when exporting Excel file ([#85](https://github.com/FlowingCode/GridExporterAddon/issues/85))
Grid Exporter Add-on version 1.9.0
#### Bug fixes:
* fix: reuse cell style ([#87](https://github.com/FlowingCode/GridExporterAddon/issues/87))
* fix: clear column cellstyle info before starting the export([#100](https://github.com/FlowingCode/GridExporterAddon/issues/100))
#### New features:
* feat: add support for providing excel formats per cell([#93](https://github.com/FlowingCode/GridExporterAddon/issues/93))
Grid Exporter Add-on version 2.3.0
#### Bug fixes:
* fix: clear column cellstyle info before starting the export([#100](https://github.com/FlowingCode/GridExporterAddon/issues/100))
#### New features:
* feat: add UTF-8 with BOM support for CSV exported files ([#89](https://github.com/FlowingCode/GridExporterAddon/issues/89))
* feat: add support for providing excel formats per cell([#93](https://github.com/FlowingCode/GridExporterAddon/issues/93))
Grid Exporter Add-on version 1.9.1
#### Bug fixes:
* Fix inconsistent styling of footer cell ([#105](https://github.com/FlowingCode/GridExporterAddon/issues/105))
Grid Exporter Add-on version 2.3.1
#### Bug fixes:
* Fix inconsistent styling of footer cell ([#105](https://github.com/FlowingCode/GridExporterAddon/issues/105))
Grid Exporter Add-on version 2.3.2
#### Bug fixes:
* Upgrade font-awesome to 5.2.2 ([#104](https://github.com/FlowingCode/GridExporterAddon/issues/104))
Grid Exporter Add-on version 2.4.0
#### New features:
* Implement concurrent export limit ([#117](https://github.com/FlowingCode/GridExporterAddon/issues/117))
* Disable button while file is being downloaded ([#126](https://github.com/FlowingCode/GridExporterAddon/issues/126))
* Support cancelling queued downloads if the UI is closed ([#127](https://github.com/FlowingCode/GridExporterAddon/issues/127))
#### Bug fixes:
* Use StreamResourceWriter instead of InputStreamFactory
* Simplify exception handling ([#123](https://github.com/FlowingCode/GridExporterAddon/issues/123))
* Fix problem when exporting grids with only one column ([#124](https://github.com/FlowingCode/GridExporterAddon/issues/124))
Grid Exporter Add-on version 2.5.0
#### New features and bug fixes:
* Add support for dynamic filename ([#113](https://github.com/FlowingCode/GridExporterAddon/issues/113))
* Add support for multiple header rows ([#147](https://github.com/FlowingCode/GridExporterAddon/pull/147))
* Update docx4j version and add required maven deps so that pdf export works ([#136](https://github.com/FlowingCode/GridExporterAddon/issues/136))
* Apply excel format for blank cells ([#159](https://github.com/FlowingCode/GridExporterAddon/issues/159))
* Avoid returning nulls to prevent later NPE ([#164](https://github.com/FlowingCode/GridExporterAddon/pull/164))
* Refactor package protected attributes "grid" and "propertySet" ([#145](https://github.com/FlowingCode/GridExporterAddon/issues/145))([#151](https://github.com/FlowingCode/GridExporterAddon/issues/151))
Grid Exporter Add-on version 2.5.1
No changes since 2.5.0.
This add-on is now released through Maven Central.