Re: [Beankeeper-discussion] managed transactions + persistence
Brought to you by:
demonsystem
From: Brautigam R. <de...@ne...> - 2009-02-09 23:36:09
|
Frank Weber írta: > Hallo Robert, > >> So BeanKeeper does not have any bindings yet out-of-the-box, but you >> don't have to use unmanaged transaction either. You just create a >> binding for the specific container you are trying to use, like Spring. >> There were already projects, where BeanKeeper was used with AOP only >> (with a @Tx annotation on methods) for example. > > So far I have not ventured to much into the AOP space. The tutorial > states related to JBoss AOP: "With minimal configuration you can > easily mark a method to be handled in a single transaction, ..." > To my understanding this refers to starting the transaction before and > committing the transaction after a business method like for example > createPerson(..). But I still need to explicitly invoke store(person) > in createPerson(..), or? Yes, you have to call Store.save(person) or Store.remove(person) explicitly to tell BeanKeeper what to do. This is unlike other persistence frameworks which "track" your objects runtime. BeanKeeper only does something if it's told to do something. If you want to somehow abstract BeanKeeper out of your code, you can write a good interface and use that instead of Store with a factory pattern for example. > Thanks in advance, > Frank Robert. |