|
本人yongStruts2+hibernate3+spring2 做一个简单的往数據库表單添加记錄的测试时出现的问题:
在 applicationContext.xml -----(因为yongmyeclipseshengcheng这个)----實际上就是hibernateDe配置XML文jian
中:
<?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">
<!-- Description:main configure file for database,hibernate, dataBean, and dataAccess(DAO)-->
<!-- configue the data source, later loaded to data factory below -->
<bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.postgresql.Driver"></property>
<property name="url" value="jdbc:postgresql://localhost:5432/project"></property>
<property name="username" value="postgres"></property>
<property name="password" value="TAUBRISS"></property>
</bean>
<!-- construct the data factory -->
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- load data source -->
<property name="dataSource">
<ref bean="DataSource" />
</property>
<!-- define the relationship between hibernate and database(here: hibernate-postgresql) -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
</props>
</property>
<!-- bean file start mapping here -->
<property name="mappingResources">
<list>
<value>com/project/beans/KeywordTbl.hbm.xml</value>
<value>com/project/beans/AuthorNewsTbl.hbm.xml</value>
<value>com/project/beans/PubauthorrelationTbl.hbm.xml</value>
<value>com/project/beans/AuthorTbl.hbm.xml</value>
<value>com/project/beans/UserTbl.hbm.xml</value1>
<value>com/project/beans/PubkeywordrelationTbl.hbm.xml</value>
<value>com/project/beans/PublicationTbl.hbm.xml</value>
</list>
</property>
</bean>
<!-- dao file start mapping here: -->
<bean id="KeywordTblDAO" class="com.project.dao.KeywordTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<bean id="AuthorNewsTblDAO"
class="com.project.dao.AuthorNewsTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<bean id="ubauthorrelationTblDAO"
class="com.project.dao.PubauthorrelationTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<bean id="AuthorTblDAO" class="com.project.dao.AuthorTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<bean id="UserTblDAO" class="com.project.dao.UserTblDAO">
<property name="sessionFactory">
<1ref bean="SessionFactory" />
</property>
</bean>
<bean id="PubkeywordrelationTblDAO"
class="com.project.dao.PubkeywordrelationTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<bean id="PublicationTblDAO"
class="com.project.dao.PublicationTblDAO">
<property name="sessionFactory">
<ref bean="SessionFactory" />
</property>
</bean>
<!-- action mapping -->
这部分还没有写的時候
</beans>歡迎来到Java学习者论壇,转载请注明地址:http://www.javaxxz.com. |
|