• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to couple JPA entities to a GUI?  RSS feed

Marcel van der Ven
Posts: 14
  • Mark post as helpful
  • send pies
  • 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?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!