I'm trying to develop a pattern for transparent persistence in web applications. At the moment I'm using Struts and Hibernate to develop the application and Xdoclet to create descriptors.
Whilst it works well, I still seem to be wasting a lot of time writing the same type of code, to locate a DAO and persist the bean. I'd like to be able to devise a method of implementing transparent persistence, in the most
painless way possible.
I have been considering using Aspectj (http://www.aspectj.org) to manipulate the beans to insert the callbacks that are needed inform the bean that it
needs to be persisted. The problem is deciding where I should put the callbacks, i.e. when the bean is finalized it could sync itself with the database (I'm only using this as an example - I don't want to implement it like this). Perhaps I should modify the constructor with an aspect which registers it with a listener that will handle the persistence when the correct callback is made?
Note - I am sort of thinking out loud, what I want is to create a very simple pattern for this and not get bogged down in creating a JBoss 4 style AOP/CMP style framework!
Any advice would be greatly appreciated.
AB
-
transparent persistence (2 messages)
- Posted by: graham o'regan
- Posted on: November 04 2003 04:58 EST
Threaded Messages (2)
- transparent persistence by graham o'regan on November 04 2003 14:23 EST
- How did your struts / aspectj solution work? by Aaron Oathout on April 28 2004 23:47 EDT
-
transparent persistence[ Go to top ]
- Posted by: graham o'regan
- Posted on: November 04 2003 14:23 EST
- in response to graham o'regan
I've been thinking about it and thought of adding after() advice to the struts action to make sure that the beans that have been used in the actions have been persisted. Any got any views on that? -
How did your struts / aspectj solution work?[ Go to top ]
- Posted by: Aaron Oathout
- Posted on: April 28 2004 23:47 EDT
- in response to graham o'regan
I've been looking at doing a transparent persistence using aspectj and was wondering how your implementation was working in the struts layer?