Anupam Gupta
Anupam Gupta

Reputation: 1687

Xml-Mystery in writing Hibernate with Spring

Can someone help me in solving Xml mystery of Doctype vs Schema in writing hibernate-Spring program? I am writing it for first time can any one help me with versions. I have read online that:

  1. Schema is required in xml for Spring 2.x and hibernate 3.1
  2. Doctype is required for earlier version

Can any one tell me what is the significance of n+1 number of blah blah we write in our schema and when to use what?

Thanks in advance.

Upvotes: 2

Views: 586

Answers (1)

Satadru Biswas
Satadru Biswas

Reputation: 1595

Its time to upgrade your versions of Spring and Hibernate.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/aop
                        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                        http://www.springframework.org/schema/tx
                        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.0.xsd
                        http://www.springframework.org/schema/mvc


        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"></beans>

So with this beans namespace definition you will be able to use aop, tx, jee, context and mvc tags in your spring application context. All beans are to be declared within the element (it is quite obvious from the tag name itself). Most of the IDE which support Spring integration can help you out defining the bean files and namespaces. I would recommend STS.

Upvotes: 2

Related Questions