义齿


  • xmlファイルマッピング
    <bean id="sessionFactory"
    	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	<property name="dataSource">
    		<ref bean="dataSource" />
    	</property>
    	<property name="hibernateProperties">
    		<props>
    			<prop key="hibernate.dialect">
    				org.hibernate.dialect.MySQLDialect
    			</prop>
    		</props>
    	</property>
    	<property name="mappingResources">
    		<list>
    			<value>po/User.hbm.xml</value>
    		</list>
    	</property>
    </bean> 
    
    を使用 
  • annotationマッピング
    <bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.MySQLDialect
    				</prop>
    			</props>
    		</property>
    		<property name="annotatedClasses">
    			<list>
    				<value>po.User</value>
    			</list>
    		</property>
    	</bean>
    を使用 
  • Data Source構成
    <bean id="dataSource"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName"
    			value="com.mysql.jdbc.Driver">
    		</property>
    		<property name="url" value="jdbc:mysql://localhost/test"></property>
    		<property name="username" value="root"></property>
    		<property name="password" value="root"></property>
    	</bean>