Thread: Spring-ojb
View Single Post
  #1 (permalink)  
Old October 15th, 2005, 09:17 PM
dtrprasad dtrprasad is offline
Registered User
 
Join Date: Oct 2005
Location: Chennai, Tamilanadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Spring-ojb

I tried for Springframework to interact with Oracle9i using apache's ojb throw spring beans.
 i had given OJB-repository.xml as
<descriptor-repository version="1.0">
 <jdbc-connection-descriptor
   jcd-alias="oraSource" default-connection="true"
   platform="Oracle9i" jdbc-level="3.0" useAutoCommit="1" username="scott" password="tiger">
    <object-cache
class="org.apache.ojb.broker.cache.ObjectCachePerB rokerImpl">
    </object-cache>
    <connection-pool maxActive="10" maxIdle="2" maxWait="3"
validationQuery=""
     logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="8"/>
    </jdbc-connection-descriptor>

   <class-descriptor class="com.htc.springdemos.ojbs.StudentVO" table="STUDENTS">
      <field-descriptor name="stuId" column="STU_ID" primarykey="true" autoincrement="true"/>
  <field-descriptor name="stuName" column="STU_NAME" />
  <field-descriptor name="course" column="COURSE" />
        </class-descriptor>
</descriptor-repository>

in the ojb.properties i had given
ConnectionFactoryClass=org.springframework.orm.ojb .support.TransactionAwareDataSourceConnectionFacto ry as the only change

in beans.xml file (ojb1.xml)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="ojbConfigurer" class="org.springframework.orm.ojb.support.LocalOj bConfigurer" />
  <bean id="oraSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
   <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
   </property>
      <property name="url"> <value>jdbc:oracle:thin:@localhost:1521:oracle10 </value>
   </property>
   <property name="username">
    <value>scott</value>
   </property>
   <property name="password">
    <value>tiger</value>
   </property>
  </bean>

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

 <bean id="studentDao" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
   <property name="transactionManager">
    <ref bean="transactionManager" />
   </property>
   <property name="target">
    <bean class="com.htc.springdemos.ojbs.StudentDAOImpl" />
   </property>
   <property name="transactionAttributes">
    <props>
       <prop key="insert*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="update*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="delete*">
         PROPAGATION_REQUIRED
       </prop>
      <prop key="*">
         PROPAGATION_REQUIRED,readOnly
       </prop>
    </props>
   </property>
   </bean>
</beans>


but when i run it is constantly giving only one error

[java] caused by:java.lang.IllegalStateException: No Bean Factory

Configuration-LocalOjbConfigurer must be defined as Spring bean

  please can any one suggest where the mistake is
 my EMAIL is rajendra32@yahoo.co.uk







DTR Prasad
Reply With Quote