Announcement Announcement Module
Collapse
No announcement yet.
can i reuse xdocled generated cfg-files? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • can i reuse xdocled generated cfg-files?

    hi @ all

    i'm planing to use spring in my project which has already a stable access to a database
    which use hibernate as or/mapper. all the config files for hibernate are generated automatically
    by xdoclet and stored in a seperated diretory.

    am i able to reuse these config-files to configure the spring framework for hibernate access
    or must i rewrite everythin in the xml-files readed by spring?

    has anybody the same idear or have i made a big mistake?
    i'm just very new to spring

    thanks for response

  • #2
    Yes you can re-use it. You just have to refer to it. Look at Spring's petclinic sample applicationContext-hibernate.xml.

    Comment


    • #3
      sorry i found the part in the config file after i have posted the text

      Comment


      • #4
        Originally posted by psychorav
        sorry i found the part in the config file after i have posted the text
        What about the hibernate.cfg.xml file? Do I really need to enter
        all info already generated by XDoclet? Didn't find anything useful
        in the petclinic app. It still contained info from that file..

        /S

        Comment


        • #5
          i told xdoclet to generate all the hbm.xml file plus the hibernate.cfg.xml in the /WEB-INF/classes directory of the webmodule. then i told spring to initialise the sessionFactory
          Code:
          	<bean id="sessionFactory"
          	      class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
          	      <property name="dataSource"><ref local="dataSource"/> </property>
          	      <property name="configLocation"><value>classpath&#58;hibernate.cfg.xml</value></property>
          	 	 <property name="hibernateProperties">
          		<props>
          	        <prop key="hibernate.dialect">$&#123;db.dialect&#125;</prop>
          		</props>
          		</property>
             </bean>
          so everything is done automatically

          Comment


          • #6
            There is a thread on the dev list discussing this.

            Comment

            Working...
            X