• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Himai Minh
  • Carey Brown
  • Frits Walraven

How to couple JPA entities to a GUI?

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a question about how you "couple" JPA entities to a GUI.

I am designing a database application for a company where they can store orders, customers, employees, invoices etc.
The database is stored into SQL Server 2008, and I use Netbeans 6.8 to develop the GUI.

At this moment all tables and connections are generated, now I am working on the GUI.
The application will consist off a lot of forms where information can be inserted and stored into the database. Now I have to couple the database to the GUI, to do this I use JPA and Hibernate.

My question now is how do I couple the entities that where generated by Netbeans to my GUI?
I find a example in a JPA book where they have a Employee entity class, the main program in this example uses a EmployeeService class to create a Employee class and to fill the Employee entity and at the end store this entity into the database.

In my application some forms have many tables where information has to be stored after the user has finished the form. Now if I follow the example from the book I need to define a separate class xxxService which fills my entities with the data from the form, and at the end commit all data to the database. After the user closes the form the xxxService class will be destroyed.
Is this a common approach or are there better ways to do this?

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic