You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Saman Ghodsian <gs...@hotmail.com> on 2006/03/09 21:10:09 UTC

Spring Transactions

Hi there,

 

I have an implementation of my model with OJB using just PersistenceBroker.
Now I'm looking into adding transactional support, looked into ODMG but it
seems complex to implement since all my mapping and query is in Broker
lingo, so I'm looking at injecting Transaction support for my process
methods with spring, that way I shouldn't need to change config files and
just one class that interfaces with the Broker. Now, I tried to look for
samples outthere found this 

 

http://www.springframework.org/node/116

 

But after setting it up transactions don't seem to be happening. So my
questions are.

1-       Do I need to use InnoDB on Mysql ? My tables are MyIsam.

2-       Am I missing any other feature besides applicationContext setup and
deriving my class from PersistenceBrokerDaoSupport?

 

Here is the applicationContext.xml

 

<beans>

  <!-- Transaction manager for a single OJB PersistenceBroker (alternative
to JTA) -->

  <bean id="transactionManager"
class="org.springframework.orm.ojb.PersistenceBrokerTransactionManager"/>

 

  <bean id="genericProcess" class="com.met.process.Generic"/>

 

  <bean id="payrollManager"

 
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBe
an">

    <property name="transactionManager">

      <ref local="transactionManager"/>

    </property>

    <property name="target">

      <ref local="genericProcess"/>

    </property>

    <property name="transactionAttributes">

      <props>

        <prop key="complete*">PROPAGATION_REQUIRED</prop>

        <prop key="terminate*">PROPAGATION_REQUIRED</prop>

        <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>

      </props>

    </property>

  </bean>

</beans>

 

Thanks

 

Sam


Re: Spring Transactions

Posted by Dennis Bekkering <dj...@gmail.com>.
YES you need innoDB, myIsam does not support transactions, i guess you want
transactions.

regards,
Dennis

2006/3/10, Thomas Dudziak <to...@gmail.com>:
>
> On 3/9/06, Saman Ghodsian <gs...@hotmail.com> wrote:
>
> > I have an implementation of my model with OJB using just
> PersistenceBroker.
> > Now I'm looking into adding transactional support, looked into ODMG but
> it
> > seems complex to implement since all my mapping and query is in Broker
> > lingo, so I'm looking at injecting Transaction support for my process
> > methods with spring, that way I shouldn't need to change config files
> and
> > just one class that interfaces with the Broker. Now, I tried to look for
> > samples outthere found this
> >
> > http://www.springframework.org/node/116
>
> First, you should have a look at the PetStore sample in Spring, which
> includes OJB support. Also of interest is this:
> http://staff.osuosl.org/~mckerrj/?p=3.
>
> > But after setting it up transactions don't seem to be happening. So my
> > questions are.
> >
> > 1-       Do I need to use InnoDB on Mysql ? My tables are MyIsam.
>
> You should definitely ask this in the Spring forums. Or rather, search
> the forums - MySql is a commonly used DB so there is bound to be some
> questions regarding it.
>
> > 2-       Am I missing any other feature besides applicationContext setup
> and
> > deriving my class from PersistenceBrokerDaoSupport?
>
> See the tutorial above. In short, you'll need the
> LocalDataSourceConnectionFactory that spring provides, in
> OJB.properties, and you need to declare the transaction wrapping in
> the applicationContext.xml around your management or DAO objects
> (management objects are preferred which logically bundle DB accesses
> provided by one or more DAOs).
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


--
mvg,
Dennis

Re: Spring Transactions

Posted by Thomas Dudziak <to...@gmail.com>.
On 3/9/06, Saman Ghodsian <gs...@hotmail.com> wrote:

> I have an implementation of my model with OJB using just PersistenceBroker.
> Now I'm looking into adding transactional support, looked into ODMG but it
> seems complex to implement since all my mapping and query is in Broker
> lingo, so I'm looking at injecting Transaction support for my process
> methods with spring, that way I shouldn't need to change config files and
> just one class that interfaces with the Broker. Now, I tried to look for
> samples outthere found this
>
> http://www.springframework.org/node/116

First, you should have a look at the PetStore sample in Spring, which
includes OJB support. Also of interest is this:
http://staff.osuosl.org/~mckerrj/?p=3.

> But after setting it up transactions don't seem to be happening. So my
> questions are.
>
> 1-       Do I need to use InnoDB on Mysql ? My tables are MyIsam.

You should definitely ask this in the Spring forums. Or rather, search
the forums - MySql is a commonly used DB so there is bound to be some
questions regarding it.

> 2-       Am I missing any other feature besides applicationContext setup and
> deriving my class from PersistenceBrokerDaoSupport?

See the tutorial above. In short, you'll need the
LocalDataSourceConnectionFactory that spring provides, in
OJB.properties, and you need to declare the transaction wrapping in
the applicationContext.xml around your management or DAO objects
(management objects are preferred which logically bundle DB accesses
provided by one or more DAOs).

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org