I am having a field - expiryLimit
in my Item
entity for which I thought of using joda-time Period
which would be an appropriate type to use here.
Just to explain - expiryLimit
is the number of year, month, days, or any duration after which a particular item will expire and using which I can calculate the exact expiryDate
of an Item
given a deliveryDate
.
Now the problem I'm facing is finding an appropriate way to map this type into JPA
.
Is there any available API or 3rd party library which provides some annotation to do that? Also I've used the Eclipse Link @Converter
annotation to map DateTime
with MySQL TimeStamp
. So, would I need to do the same thing with Period
also. And if yes, then to what type should I convert it. To varchar
? or to Long
? or some other type appropriate to represent a Period
.