spring + JPA: “Extend” entity classes at load-time from configuration

别等时光非礼了梦想. 提交于 2019-12-24 12:39:36

问题


In my small project I have 3 entity classes. These classes should be "extendable" by the end user by configuration (eg. human readable text based, probably xml). With extendable I mean adding fields and proper JPA annotations (including something like @ManyToOne) to them so the generated class is then a "normal" entity class.

I've already very vaguley heard of javassist, cglib, Aspectj due to using hibernate and spring. However which one would be appropriate to use? Does this work with spring? I mean when the application starts it must

  1. create the entities from config
  2. start spring context
  3. make spring "scan" them (packagesToScan) or Programmatically loading Entity classes with JPA 2.0?

My further question is if there is already some kind of library / tool that includes reading a configuration file and create the entity from it?

来源:https://stackoverflow.com/questions/15394970/spring-jpa-extend-entity-classes-at-load-time-from-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!