Hi,
thanks for the comments, unfortunately I did not quite understand - what do you
mean by "dao artifacts"? You are not suggesting me to code separate DAOs for
the EJB and web layers, are you?
In practise I was thinking about a solution like:
business logic layer class
==========================
class SomeBusinessService {
SomeBusinessService(DaoManager manager) {
this.manager = manager;
}
public int businessMethod() {
FooDao = (FooDao) manager.getDao(FooDao.class);
....
}
}
web layer code:
===============
webDaoManager = DaoManagerBuilder.buildDaoManager
(Resources.getResourceAsReader("dao_for_web.xml");
...
SomeBusinessService service = new SomeBusinessService(webDaoManager);
int bar = service.businessMethod();
...
ejb layer code:
===============
ejbDaoManager = DaoManagerBuilder.buildDaoManager
(Resources.getResourceAsReader("dao_for_ejb.xml");
...
SomeBusinessService service = new SomeBusinessService(ejbDaoManager);
int bar = service.businessMethod();
...
dao_for_web.xml would contain the config for JDBC transaction manager, and
dao_for_ejb.xml the config for EJB transaction manager.
Does this look like a usable solution?
Hofri Yehuda kirjoitti 05.06.2007 kello 15:29:
> Hi,
> It's your decision whether to load dao artifacts from classloader, or by
> uid from jar/os dir, anyhow I think you should divide between the entire
> artifacts hierarchy
> And manufacture one per each env - ejb, web.
>
> Hofri
>
> -----Original Message-----
> From: janne mattila [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 05, 2007 3:22 PM
> To: [email protected]
> Subject: RE: TransactionManager config for simultaneous EXTERNAL and
> JDBC
> transactions
>
> Hi,
>
> - unified classloader: I am not sure what you are talking about.
> Application is packed inside ear archive, DAO classes are inside a
> utility
> jar which is referenced from MANIFEST.MF by both ejb JAR and web
> app WAR.
> I would guess this means that DAO classes are loaded only once(?)
> - WebLogic 8.1
> - iBatis 2.1.7 (unfortunately updating this is not easy)
>
> Hofri Yehuda kirjoitti 05.06.2007 kello 15:14:
> > Hi Janne,
> > * Are you using a unified classloader ?
> > * which application server are you using ?
> > * which iBatis version are you using ?
> >
> > Hofri
> >
> >
> > -----Original Message-----
> > From: janne mattila [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, June 05, 2007 3:11 PM
> > To: [email protected]
> > Subject: TransactionManager config for simultaneous EXTERNAL and JDBC
> > transactions
> >
> > I am implementing a system which has a number of iBatis DAOs that are
> > used both by EJB clients and basic web application code.
> >
> > Architecture will be like
> >
> > (EJB)
> > (JSPs/Actions etc)
> > |
> > |
> > |
> > (business logic layer)
> > |
> > |
> > |
> > (DAOs)
> >
> > EJBs use container managed transactions, and hence I should use
> > EXTERNAL transaction manager.
> >
> > Web application code should use basic iBatis JNDI/SIMPLE transaction
> > manager and transactions are demarcated on the business logic layer
> > using
> > daoManager.startTransaction() etc.
> >
> > Both "business logic clients" (EJB & web app code) should use the same
> > business logic methods (which use the same DAO code). I understand I
> > can use the same business logic layer for both, since for example
> > daoManager.commitTransaction() will not do anything if EXTERNAL
> > transactions are configured?
> >
> > How should iBatis configuration be done??? Do I have to have separate
> > dao1.xml and dao2.xml files and build separate DaoManager instances
> > for the EJB clients and the web app clients?
> >
> > Anything specific that I need to worry about using this approach?
> >
> > ...................................................................
> > Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
> > Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
>
>
> ...................................................................
> Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
> Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
...................................................................
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku