Hyperjaxb/lombok : how to force Hyperjaxb generate annotations mapping on attributes and not on the methods?

StackOverflow https://stackoverflow.com/questions/16147032

سؤال

I would like jpa annotations on my attributes, not on getter and setter. It is possible to configure hyperjaxb for this ?

I want this because I use lombok in order to avoid getter and setter code and have "@getter" "@setter" above attributes.

thank you

هل كانت مفيدة؟

المحلول

This is not supported out of the box at the moment (please file an issue if you need this functionality).

However you can do it by writing and overriding your own implementation of org.jvnet.hyperjaxb3.ejb.strategy.annotate.AnnotateOutline. See https://svn.java.net/svn/hj3~svn/trunk/ejb/tests/custom-naming/ for an example of overriding a strategy.

But be aware that Hyperjaxb has to use getters/setters to workaround some of the JAXB/JPA incompatibilities (for example simple type which is not supported by JPA). If you put annotations on fields, this won't work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top