Announcement Announcement Module
Collapse
No announcement yet.
Accessing .properties file data in hbm.xml using ${} Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing .properties file data in hbm.xml using ${}

    Hi,
    i am trying to access .properties file data in .hbm.xml. please tell me steps to do this.

    e.g. in propeties file we have
    jdbc.primarykey=increment

    and in hbm.xml i want to access with following way.
    <hibernate-mapping>
    *** <class name="com.spring.sample.*domain.User" table="USERS">***
    *** *** <id name="id" column="USER_ID" type="java.lang.Long" unsaved-value="0">
    *** *** *** <generator class="${jdbc.primarykey}"/>**** *** ***
    *** *** </id>
    ** </class>
    </hibernate-mapping>
    it throws error present in hbm_propertiesError.txt present as an attachment.
    ************************************************** *************************************
    Please help me to resolve this.

    ************************************************** *************************************

    we can achieve this in .cfg.xml by following code
    <beans>
    *** <bean class="org.springframework.*beans.factory.config.* PropertyPlaceholderConfigurer"*>
    *** *** <property name="locations">
    *** *** *** <list>
    ******* *** *** <value>classpath:com/spring/*sample/properties/hibernate.*properties</value>******* *** ***
    ******* *** </list>
    *** *** </property>
    *** </bean>

    * *** <bean id="dpwlsdataSource" class="org.springframework.*jdbc.datasource.*Drive rManagerDataSource" destroy-method="close">
    *** *** <property name="driverClassName" value="${jdbc.driverClassName}*"/>
    *** *** <property name="url" value="${jdbc.url}"/>***
    *** *** <property name="username" value="${jdbc.username}"/>
    *** *** <property name="password" value="${jdbc.password}"/>
    * </bean>
    </beans>

    For more detail you can reach out to me @+91-98862-74713.

  • #2
    Use [ code][/code ] tags when posting code !

    You cannot replace properties inside hbm.xml files, it isn't going to work because it simply isn't supported.

    Comment

    Working...
    X