Obviously, using the attribute without preserving the state of the EJB beans in the bean entity smells, but please consider the following scenario and tell me if you know about a better solution:
- I have an
InvoiceTemplate Entity bean with a NextInvoiceDate field - Generating
NextInvoiceDate is a complex procedure and must be performed outside of the InvoiceTemplate class NextInvoiceDate should be updated every time InvoiceTemplate is stored in db
At the moment, I have logic regarding the generation of NextInvoiceDate in @PrePersist @PreUpdate methon in the InvoiceTemplate entity bean. The logic is becoming more complex, and I want to move it outside of the InvoiceTemplate bean. It seems to me that NextInvoiceDate must be a service to calculate NextInvoiceDate . But then, is it correct to call this service from within the InvoiceTemplate ?
mgamer
source share