Leon, I am using Hibernate with 2 different databases (mysql and
as400):  I don't think HibernateTransactionManager can handle
distributed transactions.  Even though this discussion should not be
on the struts list, but here it is:

    <bean id="myDataSource1"
class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>java:comp/env/jdbc/myds1</value>
        </property>
     </bean>

      <bean id="myDataSource2"
class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName">
            <value>java:comp/env/jdbc/myds2</value>
        </property>
    </bean>

 <bean id="mySessionFactory1"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
 <property name="dataSource">
  <ref bean="myDataSource1"/>
  <!--other hib props------>
 </property>
</bean>

 <bean id="mySessionFactory2"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
 <property name="dataSource">
  <ref bean="myDataSource2"/>
  <!--other hib props------>
 </property>
</bean>

 <bean id="myTransactionManager"
        class="org.springframework.transaction.jta.JtaTransactionManager"/>

 <bean id="myEmployeeDao" class="com....EmployeeDaoImpl">
  <property name="sessionFactory">
  <ref bean="mySessionFactory1"/>
 </property>
</bean>


 <bean id="myTicketDao" class="com....TicketDaoImpl">
  <property name="sessionFactory">
  <ref bean="mySessionFactory2"/>
 </property>
</bean>

 <bean id="myServiceTarget" class="com....MyServiceImpl">
<property name="myEmployeeDao">
 <ref bean="myEmployeeDao"/>
</property>
<property name="myTicketDao">
 <ref bean="myTicketDao"/>
</property>
</bean>

    <bean id="myProductService"
        
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
         <property name="transactionManager">
            <ref bean="myTransactionManager"/>
        </property>
        <!----other props-->
 </bean>






On 4/7/06, Leon Rosenberg <[EMAIL PROTECTED]> wrote:
> I still don't get what should be wrong with the 2 DAO, 1
> BusinessManager (or two depending on where do you want to federate, in
> business or presentation layer) and a struts action to trigger it.
>
> I thought your question was about how to do it best MVC-conform way,
> you've got Joe's and mine answer. Or was your question something
> other? If you still don't know where JTA comes into play -> your dao's
> should be able to serve 2phase-commit. Your business manager knows how
> to trigger it. Btw take a look at CORBA OTS it can do what you want
> outofthebox.
>
> Leon
>
> P.S.
>
> Personally I would put it down to two calls:
> List<Ticket> tickets = manager1.getTickets();
> List employeeIds = extractUniqueEmployeeIds(tickets)
> List<String> employeeNames = manager2.getSomeEmployeeNames(employeeIds).
>
>
>
> On 4/7/06, olonga henry <[EMAIL PROTECTED]> wrote:
> > Rick, I am not trying to be an a**ss, but what he talked about is the most
> > basic stuff to any programmer. That's what I was pointing towards.  Even you
> > admitted later that you were replying without getting complete hold of the
> > subject matter.
> > "... although I wasn't following the thread that closely and missed about
> > the different databases. I'll just shut up and let smarter people
> > answer. (I will almost bet though that hibernate isn't helping the
> > situation.)"
> > Just wanted to know if other fellow programmers know of any good design
> > patters regarding this.
> >
> >
> > On 4/7/06, Rick Reumann <[EMAIL PROTECTED]> wrote:
> > >
> > > olonga henry wrote the following on 4/7/2006 11:33 AM:
> > > > Larry, person who talks about Spring, Hibernate and struts and know
> > > about
> > > > JTA certainly knows that a database is a collection of tables.
> > >
> > > You don't have to be an a**ss when someone is just trying to get
> > > clarification. Good luck getting help from people here.
> > >
> > > Man, what has this list come to these days:)
> > >
> > > --
> > > Rick
> > > http://www.learntechnology.net
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to