| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3178 人关注过本帖
标题:DB2查询问题
只看楼主 加入收藏
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 

<?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">

<hibernate-mapping
>
<class
name="model.Admin"
table="admin"
>

<id
name="id"
column="id"
type="java.lang.Long"
length="10"
unsaved-value="null"
>
<generator class="increment">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Admin.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<property
name="userid"
type="java.lang.String"
update="true"
insert="true"
column="userid"
length="30"
unique="true"
/>

<property
name="password"
type="java.lang.String"
update="true"
insert="true"
column="password"
length="200"
/>

<property
name="position"
type="java.lang.String"
update="true"
insert="true"
column="position"
length="100"
/>

<property
name="phone"
type="java.lang.String"
update="true"
insert="true"
column="phone"
length="40"
/>

<property
name="address"
type="java.lang.String"
update="true"
insert="true"
column="address"
length="100"
/>

<property
name="remark"
type="java.lang.String"
update="true"
insert="true"
column="remark"
length="200"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Admin.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>


2007-01-12 00:24
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 

<?xml version="1.0" encoding="UTF-8"?>

<beans>
<!--定义Hibernate参数 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.ibm.db2.jcc.DB2Driver</value>
<!-- MYSQL的驱动
<value>com.mysql.jdbc.Driver</value>
-->
<!-- SQL SERVER的驱动
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
-->
</property>
<property name="url">
<value>jdbc:db2://localhost:50000/film</value>
<!-- <value>jdbc:db2:film</value>-->
<!-- 连接 Microsoft SQL Server 2000
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=registration</value>
-->
</property>
<property name="username">
<!-- <value>root</value> -->

<value>root</value>

<!--<value>db2admin</value>-->
</property>
<property name="password">
<value>987654321</value>
</property>

<property name="maxActive">
<value>30</value>
</property>
<property name="maxWait">
<value>30000</value>
</property>
<property name="defaultAutoCommit">
<value>false</value>
</property>
<property name="defaultReadOnly">
<value>false</value>
</property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<!-- DB2数据库方言 -->
<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>

<!-- MYSQL数据库方言
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>-->

<!-- SQL SERVER数据库方言
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
-->
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>model/Admin.hbm.xml</value>
<value>model/Spectator.hbm.xml</value>
<value>model/Hall.hbm.xml</value>
<value>model/Ticket.hbm.xml</value>
<value>model/Film.hbm.xml</value>
</list>
</property>
</bean>
<!--定义Hibernate参数 -->


<!-- 向BaseDAO的实现类注入SessionFactory-->
<bean id="BaseHibernateDAO" class="dao.impl.BaseHibernateDAO" lazy-init="false" singleton="true">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<!-- 向BaseDAO的实现类注入SessionFactory-->

<!-- 管理员DAO -->
<bean id="AdminDAO" class="dao.impl.AdminDAO" >
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 管理员DAO -->

<!-- 电影DAO -->
<bean id="FilmDAO" class="dao.impl.FilmDAO" >
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 电影DAO -->

<!-- 放映厅DAO -->
<bean id="HallDAO" class="dao.impl.HallDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 放映厅DAO -->

<!-- 电影票DAO -->
<bean id="TicketDAO" class="dao.impl.TicketDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 电影票DAO -->

<!-- 观众DAO -->
<bean id="SpectatorDAO" class="dao.impl.SpectatorDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 电影票DAO -->

<!-- 注入服务xxxServiceImpl之开始 -->
<bean id="AdminServiceImpl" class="service.impl.AdminServiceImpl" lazy-init="false" singleton="true">
<property name="adminDAO">
<ref bean="AdminDAO"/>
</property>
</bean>
<bean id="FilmServiceImpl" class="service.impl.FilmServiceImpl" lazy-init="false" singleton="true">
<property name="filmDAO">
<ref bean="FilmDAO"/>
</property>
<property name="baseDAO">
<ref bean="BaseHibernateDAO"/>
</property>
</bean>
<bean id="HallServiceImpl" class="service.impl.HallServiceImpl" lazy-init="false" singleton="true">
<property name="hallDAO">
<ref bean="HallDAO"/>
</property>
<property name="baseDAO">
<ref bean="BaseHibernateDAO"/>
</property>
</bean>
<bean id="TicketServiceImpl" class="service.impl.TicketServiceImpl" lazy-init="false" singleton="true">
<property name="ticketDAO">
<ref bean="TicketDAO"/>
</property>
<property name="baseDAO">
<ref bean="BaseHibernateDAO"/>
</property>
</bean>
<bean id="SpectatorServiceImpl" class="service.impl.SpectatorServiceImpl" lazy-init="false" singleton="true">
<property name="spectatorDAO">
<ref bean="SpectatorDAO"/>
</property>
<property name="baseDAO">
<ref bean="BaseHibernateDAO"/>
</property>
</bean>
<!-- 注入服务xxxServiceImpl之结束 -->





<!-- 注入事务 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="adminServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="AdminServiceImpl" />
</property>
<property name="transactionAttributes">
<props>
<prop key="show*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<bean id="filmServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="FilmServiceImpl" />
</property>
<property name="transactionAttributes">
<props>
<prop key="show*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<bean id="hallServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="HallServiceImpl" />
</property>
<property name="transactionAttributes">
<props>
<prop key="show*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<bean id="spectatorServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="SpectatorServiceImpl" />
</property>
<property name="transactionAttributes">
<props>
<prop key="show*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>

<bean id="ticketServiceProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref local="TicketServiceImpl" />
</property>
<property name="transactionAttributes">
<props>
<prop key="show*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<!-- 注入事务 -->
</beans>

[此贴子已经被作者于2007-1-12 0:47:44编辑过]


2007-01-12 00:46
想你的天空
Rank: 2
等 级:新手上路
威 望:5
帖 子:610
专家分:0
注 册:2004-12-30
收藏
得分:0 
问题已解决

2007-01-15 23:24
快速回复:DB2查询问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018703 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved