<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!--
<bean id="a"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
-->
<!-- dataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=epet"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<!-- sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" >
<ref local="dataSource"/>
</property>
<property name="mappingResources" >
<list>
<value>com/jenter/pet/entity/PetInfo.hbm.xml</value>
<value>com/jenter/pet/entity/PetDiary.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties" >
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- Dao -->
<bean id="petDao" class="com.jenter.pet.dao.PetDaoHibImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Biz -->
<bean id="petBiz" class="com.jenter.pet.biz.PetBizImpl">
<property name="petDao" ref="petDao"/>
</bean>
<!-- Action -->
<bean name="/pet" class="com.jenter.pet.action.PetActionAction" id="pet">
<property name="petBiz" ref="petBiz"/>
</bean>
</beans>
--------------------------------------------------------------------------------------------------------------------------------
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- form-beans -->
<form-beans>
<form-bean name="petForm" type="com.jenter.pet.form.PetForm" />
</form-beans>
<!-- action-mappings -->
<action-mappings >
<action path="/pet"
name="petForm"
parameter="operate"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="fir" path="/index.jsp"></forward>
</action>
</action-mappings>
<!-- message-resources -->
<message-resources parameter="com.jenter.pet.action.ApplicationResources" />
<!-- plug-in -->
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="classpath:applicationContext.xml"/>
</plug-in>
</struts-config>
-----------------------------------------------------------------------------------------------------------------------------
PetDiary.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.jenter.pet.entity.PetDiary" table="PetDiary" schema="dbo" catalog="epet">
<id name="diaryId" type="java.lang.Integer">
<column name="diary_id" />
<generator class="native" />
</id>
<many-to-one name="petInfo" class="com.jenter.pet.entity.PetInfo" fetch="select">
<column name="diary_pet_id" />
</many-to-one>
<property name="diaryDate" type="java.util.Date">
<column name="diary_date" length="23" />
</property>
<property name="diaryTitle" type="java.lang.String">
<column name="diary_title" length="300" />
</property>
<property name="diaryWeather" type="java.lang.String">
<column name="diary_weather" length="30" />
</property>
<property name="diaryContext" type="java.lang.String">
<column name="diary_context" length="7000" />
</property>
<property name="diaryIsPublic" type="java.lang.String">
<column name="diary_is_public" length="3" />
</property>
<property name="diaryLastModify" type="java.util.Date">
<column name="diary_last_modify" length="23" />
</property>
<property name="diaryAuthor" type="java.lang.String">
<column name="diary_author" length="30" />
</property>
<property name="diaryAuthorEmail" type="java.lang.String">
<column name="diary_author_email" length="200" />
</property>
</class>
</hibernate-mapping>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!--
<bean id="a"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
-->
<!-- dataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://localhost:1433;databaseName=epet"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<!-- sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" >
<ref local="dataSource"/>
</property>
<property name="mappingResources" >
<list>
<value>com/jenter/pet/entity/PetInfo.hbm.xml</value>
<value>com/jenter/pet/entity/PetDiary.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties" >
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- Dao -->
<bean id="petDao" class="com.jenter.pet.dao.PetDaoHibImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Biz -->
<bean id="petBiz" class="com.jenter.pet.biz.PetBizImpl">
<property name="petDao" ref="petDao"/>
</bean>
<!-- Action -->
<bean name="/pet" class="com.jenter.pet.action.PetActionAction" id="pet">
<property name="petBiz" ref="petBiz"/>
</bean>
</beans>
--------------------------------------------------------------------------------------------------------------------------------
struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- form-beans -->
<form-beans>
<form-bean name="petForm" type="com.jenter.pet.form.PetForm" />
</form-beans>
<!-- action-mappings -->
<action-mappings >
<action path="/pet"
name="petForm"
parameter="operate"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="fir" path="/index.jsp"></forward>
</action>
</action-mappings>
<!-- message-resources -->
<message-resources parameter="com.jenter.pet.action.ApplicationResources" />
<!-- plug-in -->
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="classpath:applicationContext.xml"/>
</plug-in>
</struts-config>
-----------------------------------------------------------------------------------------------------------------------------
PetDiary.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.jenter.pet.entity.PetDiary" table="PetDiary" schema="dbo" catalog="epet">
<id name="diaryId" type="java.lang.Integer">
<column name="diary_id" />
<generator class="native" />
</id>
<many-to-one name="petInfo" class="com.jenter.pet.entity.PetInfo" fetch="select">
<column name="diary_pet_id" />
</many-to-one>
<property name="diaryDate" type="java.util.Date">
<column name="diary_date" length="23" />
</property>
<property name="diaryTitle" type="java.lang.String">
<column name="diary_title" length="300" />
</property>
<property name="diaryWeather" type="java.lang.String">
<column name="diary_weather" length="30" />
</property>
<property name="diaryContext" type="java.lang.String">
<column name="diary_context" length="7000" />
</property>
<property name="diaryIsPublic" type="java.lang.String">
<column name="diary_is_public" length="3" />
</property>
<property name="diaryLastModify" type="java.util.Date">
<column name="diary_last_modify" length="23" />
</property>
<property name="diaryAuthor" type="java.lang.String">
<column name="diary_author" length="30" />
</property>
<property name="diaryAuthorEmail" type="java.lang.String">
<column name="diary_author_email" length="200" />
</property>
</class>
</hibernate-mapping>