barbosa
Feb 23rd, 2005, 11:26 AM
Hello all !
My doubt is about singletons and or prototypes.
1) Simple domain objects(beans) should always be prototypes ?!
2) DAO´s should be prototype too ?!
An example:
Suppose i have a userDAO and a "save method" defined with propagation_required.
That must run within a existing transaction otherwise it will start a new one.
Ok.
If the DAO is singleton , when two diferent people call the "save method" it will share the same DAO, then the transaction too !?
3)Propagation_required works like this !?
methodA () { doSomething() -> starts a new transaction
doOther() -> uses the same transaction !?
}
!
My doubt is about singletons and or prototypes.
1) Simple domain objects(beans) should always be prototypes ?!
2) DAO´s should be prototype too ?!
An example:
Suppose i have a userDAO and a "save method" defined with propagation_required.
That must run within a existing transaction otherwise it will start a new one.
Ok.
If the DAO is singleton , when two diferent people call the "save method" it will share the same DAO, then the transaction too !?
3)Propagation_required works like this !?
methodA () { doSomething() -> starts a new transaction
doOther() -> uses the same transaction !?
}
!