0

We started writing a Java Framework for our company. But we don't have enough experience about Java. We decided to use JPA framework for database CRUD operations.

What do you suggest about that:

  1. about defining persistence.xml. We search creating dynamic EntityManager and found some documents but we don't know that is it best way.
  2. Is it a good way that create a layer over JPA base db operations? (for example CRUD methods.)
  3. How can we do calling JPA CRUD methods from my CRUD methods in framework?
  4. We will use this framework for desktop and web applications. Is deployment a problem for us.
  5. Do we have to use EJB?
  6. Is there alternative to JPA which you suggest? (example: ADF,JDBC)

Thanks

Tiny
  • 27,221
  • 105
  • 339
  • 599
Müslüm ÖZTÜRK
  • 961
  • 1
  • 11
  • 30

1 Answers1

0

It highly depends on your requirements and what you want to do with your "framework". I do not know enough of your project to give you a real advise, but here are some thoughts:

  • What do you mean with "framework"? Are you developing a library which other people should use? What should be the purpose of your framework? Is it a data access layer for some of your company data? If so: JPA is a kind of a standard and might be a good fit since it is widely used. If other people should use your "framework" it is good to use something which is standard and used in many other applications and tools.
  • Do you really need a data access layer on the desktop? Do you have a rich client? It is no problem to just "deploy" the application to the desktop, but a data access layer must always be configured and (maybe) updated. And that's where the pain begins when you use a rich client. Users must configure a database, the database must be installed or accessible remote and the version of the client must match the version of the database. Sooner or later this will hit you.
  • What else have you considered already? What about a ORM? Hibernate might by a good and popular fit. Also eBeans which is used in Play! is very cool. If you make a CRUD applications, frameworks like eBeans are doing most of the work out-of-the-box for you. You create a model (just POJOs + annotations) and the frameworks provides the complete data access layer (including the database setup).
Thomas Uhrig
  • 30,811
  • 12
  • 60
  • 80