Another issue I'm facing with Roo's rich Entity model:
How do I go about marking static methods transactional? I would like to be able to use the declarative way (i.e. @Transactional) instead of using, say, TransactionTemplate to drive transactions.
As an example, say I have an entity class called "Reservation" that carries an associated date. When the date has passed, I would like to remove the Reservation via a scheduled task that is run periodically. Hence what I would like to have is a static method Reservation.deletePastReservations(), that is executed via the Spring TaskExecutor abstraction, and run within a transaction.
Marking the static method with @Transactional does not do the trick. I can go around this by using an instance of the Reservation class and delegating to an instance method marked with @Transactional to do the work, but this looks like a hack, even though it is fairly concise. Can I somehow configure the aspectj TransactionAspect to include static methods?
I'm using maven 2.2 to build and it includes the aspectj plugin.
Any ideas? Or am I approaching the issue from an incorrect angle?