CDillinger wrote:
None of my hibernate projects ever had a file named hibernate.properties. There must be something wrong with you mappings or with your source. The output you posted looks okay.
Hi Dilinger,
Thanks for reply. I am showing you some internal code which i have done in my project. Please help where i have done the mistake. Actually what i did is in Spring Configuration file i kept my all hibernate configuration connectivity. Through this Spring Configuration files i am doing all mapping with hbm files. Please check this code and please help me on this scenarios.
spring-config.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName"><value>com.ibm.db2.jcc.DB2Driver</value></property>
<property name="url"><value>jdbc:db2://DBDATAURL:50000/CLAIMSDB</value></property>
<property name="username"><value>system</value></property>
<property name="password"><value>password</value></property>
</bean>
<bean id="DatabaseHelper" class="com.awpl.pruindo.db.DBHelper">
<property name="dataSource"> <ref local="dataSource"/> </property>
<property name="schema"><value>system</value></property>
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>com/awpl/pruindo/config/Appliedbenefits.hbm.xml</value>
<value>com/awpl/pruindo/config/Clientpolicies.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.default_schema">system</prop>
</props>
</property>
</bean>
<bean id="HibernateSpringDaoTarget" class="com.awpl.pruindo.dao.hibernate.SpringHibernatDAOImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
</beans>
Appliedbenefits.hbm.xml :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 10, 2010 7:47:54 PM by Hibernate Tools 3.2.4.GA -->
<hibernate-mapping>
<class name="com.awpl.model.Appliedbenefits" table="APPLIEDBENEFITS">
<composite-id name="id" class="com.awpl.model.AppliedbenefitsId">
<key-property name="benefitslno" type="short">
<column name="BENEFITSLNO" />
</key-property>
<key-property name="claimsslno" type="long">
<column name="CLAIMSSLNO"/>
</key-property>
<key-property name="polslno" type="short">
<column name="POLSLNO" />
</key-property>
</composite-id>
<many-to-one name="clientpolicies" class="com.awpl.model.Clientpolicies" update="false" insert="false" fetch="select">
<column name="CLAIMSSLNO" not-null="true" />
<column name="POLSLNO" not-null="true" />
</many-to-one>
<property name="claimnumber" type="string">
<column name="CLAIMNUMBER" length="15"/>
</property>
<property name="alterationnumber" type="string">
<column name="ALTERATIONNUMBER" />
</property>
<property name="alterationdate" type="date">
<column name="ALTERATIONDATE" length="10"/>
</property>
<property name="ridercode" type="string">
<column name="RIDERCODE" length="10" not-null="true" />
</property>
<property name="ridernumber" type="string">
<column name="RIDERNUMBER" length="10" not-null="true" />
</property>
<property name="riderstatus" type="string">
<column name="RIDERSTATUS" length="15" not-null="true" />
</property>
<property name="lifeassuredno" type="string">
<column name="LIFEASSUREDNO" length="10" not-null="true" />
</property>
<property name="coverageno" type="string">
<column name="COVERAGENO" length="15" not-null="true" />
</property>
<property name="clientnumber" type="string">
<column name="CLIENTNUMBER" length="15" not-null="true" />
</property>
<property name="sumassured" type="double">
<column name="SUMASSURED" precision="53" scale="0" not-null="true" />
</property>
<property name="appliedbenefit" type="string">
<column name="APPLIEDBENEFIT" length="5" not-null="true" />
</property>
<property name="alterationtype" type="string">
<column name="ALTERATIONTYPE" length="20" />
</property>
<property name="docid" type="string">
<column name="DOCID" length="10" not-null="true" />
</property>
</class>
</hibernate-mapping>
Clientpolicies.hbm.xml :
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Feb 10, 2010 7:47:54 PM by Hibernate Tools 3.2.4.GA -->
<hibernate-mapping>
<class name="com.awpl.model.Clientpolicies" table="CLIENTPOLICIES">
<composite-id name="id" class="com.awpl.model.ClientpoliciesId">
<key-property name="claimsslno" type="long">
<column name="CLAIMSSLNO" />
</key-property>
<key-property name="polslno" type="short">
<column name="POLSLNO" />
</key-property>
</composite-id>
<property name="policynumber" type="string">
<column name="POLICYNUMBER" length="10" not-null="true" />
</property>
<property name="processinstance" type="string">
<column name="PROCESSINSTANCE" length="150" not-null="true" />
</property>
<property name="processstatus" type="string">
<column name="PROCESSSTATUS" length="15" not-null="true" />
</property>
<property name="startdate" type="timestamp">
<column name="STARTDATE" length="26" not-null="true" />
</property>
<set name="appliedbenefitses" inverse="true" lazy="true" table="APPLIEDBENEFITS" fetch="select">
<key>
<column name="CLAIMSSLNO" not-null="true" />
<column name="POLSLNO" not-null="true" />
</key>
<one-to-many class="com.awpl.model.Appliedbenefits" />
</set>
</class>
</hibernate-mapping>
These are xml files can you please help me from this files where is the problem. Another thing that i am thinking that there is some problem in spring-config.xml files. Please help me.
Thanks & Regards
Sailendra Narayan Jena