3

I want to share my Models with some other projects, they use the same models but not the same field mappings and constraints. I wonder if there is way to extract annotations from models and use xml configuration instead ? Or other way to achieve this ?

NOTE : I'm using play 1.3.

WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138

1 Answers1

1

Last week I were analyzing something like that.

A way to archive this is:

  1. generate a library (jar) for each reusable models, defined by annotations or by orm.xml files on META-INF folder (but not presistence.xml).
  2. In web application project, reference required model libraries and define the entityManager using a persistence.xml on META-INF.

For more information see the JPA spec, 6.2 Persistence Unit Packaging

Other references:

Good luck!

Community
  • 1
  • 1
jmvivo
  • 2,653
  • 1
  • 16
  • 20