简体   繁体   中英

Playframework : How to share models between different projects?

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 .

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM