facebook

Hibernate Reverse engineering not creating correct classes

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #292181 Reply

    smcelroy
    Member

    Hello,

    I have created a reveng settings file that is not creating the desired resuts. The tables in the database I am using have ‘app_’ and ‘ref_’ prefixes and I was using the reveng settings file to manipulate the generation of the class names not to include these prefixes. I know I could use a naming strategy but I don’t want to do that. So for example I have a table called APP_EXCLUDE_PATH and I would expect the the generated class to be called ExcludePath but its called AppExcludePath. I have included me reveng settings file below in the hope that someone can point out what it is I am doing wrong.

    Thanks.

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
    
    <hibernate-reverse-engineering>
    
        <table name="APP_EXCLUDE_PATH" class="com.trovare.dal.dto.ExcludePath">
            <column name="EP_ID" property="id"/>
            <column name="EP_IND_ID" property="indexId"/>
            <column name="EP_PATH" property="path"/>
        </table>
        <table name="APP_INCLUDE_PATH" class="com.trovare.dal.dto.IncludePath">
            <column name="IP_ID" property="id"/>
            <column name="IP_IND_ID" property="indexId"/>
            <column name="IP_PATH" property="path"/>
        </table>
        <table name="APP_INDEX" class="com.trovare.dal.dto.Index">
            <column name="IND_ID" property="id"/>
            <column name="IND_NAME" property="name"/>
            <column name="IND_DESCRIPTION" property="description"/>
        </table>
        <table name="APP_INDEX_DOC_TYPE_LINK" class="com.trovare.dal.dto.IndexDocTypeLink">
            <column name="IDTL_IND_ID" property="indexId"/>
            <column name="IDTL_DT_ID" property="docTypeId"/>
        </table>
        <table name="APP_INDEX_GROUP" class="com.trovare.dal.dto.IndexGroup">
            <column name="IGR_ID" property="id"/>
            <column name="IGR_NAME" property="name"/>
            <column name="IGR_DESCRIPTION" property="description"/>
        </table>
        <table name="APP_INDEX_INDEX_GROUP_LINK" class="com.trovare.dal.dto.IndexIndexGroupLink">
            <column name="IIGL_IND_ID" property="indexId"/>
            <column name="IIGL_IGR_ID" property="indexGroupId"/>
        </table>
        <table name="APP_PREFERENCE" class="com.trovare.dal.dto.Preference">
            <column name="PREF_ID" property="id"/>
            <column name="PREF_RESULTS_PER_PAGE" property="resultsPerPage"/>
        </table>
        <table name="APP_PREFERENCE_INDEX_LINK" class="com.trovare.dal.dto.PreferenceIndexLink">
            <column name="PIL_PREF_ID" property="preferenceId"/>
            <column name="PIL_IND_ID" property="indexId"/>
        </table>
        <table name="APP_ROLE" class="com.trovare.dal.dto.Role">
            <column name="ROL_ID" property="id"/>
            <column name="ROL_NAME" property="name"/>
            <column name="ROL_DESCRIPTION" property="description"/>
        </table>
        <table name="APP_SCHEDULE" class="com.trovare.dal.dto.Schedule">
            <column name="SCH_ID" property="id"/>
            <column name="SCH_IND_ID" property="indexId"/>
        </table>
        <table name="APP_USER" class="com.trovare.dal.dto.User">
            <column name="USR_ID" property="id"/>
            <column name="USR_FIRST_NAME" property="firstName"/>
            <column name="USR_LAST_NAME" property="lastName"/>
            <column name="USR_USER_NAME" property="userName"/>
            <column name="USR_EMAIL_ADDRESS" property="emailAddress"/>
            <column name="USR_PASSWORD" property="password"/>
        </table>
        <table name="APP_USER_INDEX_GROUP_LINK" class="com.trovare.dal.dto.UserIndexGroupLink">
            <column name="UIGL_USR_ID" property="userId"/>
            <column name="UIGL_IGR_ID" property="indexGroupId"/>
        </table>
        <table name="APP_USER_INDEX_LINK" class="com.trovare.dal.dto.UserIndexLink">
            <column name="UIL_USR_ID" property="userId"/>
            <column name="UIL_IND_ID" property="indexId"/>
        </table>
        <table name="APP_USER_ROLE_LINK" class="com.trovare.dal.dto.UserRoleLink">
            <column name="URL_USR_ID" property="userId"/>
            <column name="URL_ROL_ID" property="roleId"/>
        </table>
        <table name="REF_DOC_TYPE" class="com.trovare.dal.dto.DocType">
            <column name="DT_ID" property="id"/>
            <column name="DT_EXTENSION" property="extension"/>
            <column name="DT_DESCRIPTION" property="description"/>
        </table>
    
    
    </hibernate-reverse-engineering>
    
    #292187 Reply

    smcelroy
    Member

    I found the solution. I had to add the schema attribute to the table element as shown below.

    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
    
    <hibernate-reverse-engineering>
    
        <table name="APP_EXCLUDE_PATH" class="com.trovare.dal.dto.ExcludePath" schema="PUBLIC">
            <column name="EP_ID" property="id" />
            <column name="EP_IND_ID" property="indexId" />
            <column name="EP_PATH" property="path" />
        </table>
        <table name="APP_INCLUDE_PATH" class="com.trovare.dal.dto.IncludePath" schema="PUBLIC">
            <column name="IP_ID" property="id" />
            <column name="IP_IND_ID" property="indexId" />
            <column name="IP_PATH" property="path" />
        </table>
        <table name="APP_INDEX" class="com.trovare.dal.dto.Index" schema="PUBLIC">
            <column name="IND_ID" property="id" />
            <column name="IND_NAME" property="name" />
            <column name="IND_DESCRIPTION" property="description" />
        </table>
        <table name="APP_INDEX_DOC_TYPE_LINK" class="com.trovare.dal.dto.IndexDocTypeLink" schema="PUBLIC">
            <column name="IDTL_IND_ID" property="indexId" />
            <column name="IDTL_DT_ID" property="docTypeId" />
        </table>
        <table name="APP_INDEX_GROUP" class="com.trovare.dal.dto.IndexGroup" schema="PUBLIC">
            <column name="IGR_ID" property="id" />
            <column name="IGR_NAME" property="name" />
            <column name="IGR_DESCRIPTION" property="description" />
        </table>
        <table name="APP_INDEX_INDEX_GROUP_LINK" class="com.trovare.dal.dto.IndexIndexGroupLink" schema="PUBLIC">
            <column name="IIGL_IND_ID" property="indexId" />
            <column name="IIGL_IGR_ID" property="indexGroupId" />
        </table>
        <table name="APP_PREFERENCE" class="com.trovare.dal.dto.Preference" schema="PUBLIC">
            <column name="PREF_ID" property="id" />
            <column name="PREF_RESULTS_PER_PAGE" property="resultsPerPage" />
        </table>
        <table name="APP_PREFERENCE_INDEX_LINK" class="com.trovare.dal.dto.PreferenceIndexLink" schema="PUBLIC">
            <column name="PIL_PREF_ID" property="preferenceId" />
            <column name="PIL_IND_ID" property="indexId" />
        </table>
        <table name="APP_ROLE" class="com.trovare.dal.dto.Role" schema="PUBLIC">
            <column name="ROL_ID" property="id" />
            <column name="ROL_NAME" property="name" />
            <column name="ROL_DESCRIPTION" property="description" />
        </table>
        <table name="APP_SCHEDULE" class="com.trovare.dal.dto.Schedule" schema="PUBLIC">
            <column name="SCH_ID" property="id" />
            <column name="SCH_IND_ID" property="indexId" />
        </table>
        <table name="APP_USER" class="com.trovare.dal.dto.User" schema="PUBLIC">
            <column name="USR_ID" property="id" />
            <column name="USR_FIRST_NAME" property="firstName" />
            <column name="USR_LAST_NAME" property="lastName" />
            <column name="USR_USER_NAME" property="userName" />
            <column name="USR_EMAIL_ADDRESS" property="emailAddress" />
            <column name="USR_PASSWORD" property="password" />
        </table>
        <table name="APP_USER_INDEX_GROUP_LINK" class="com.trovare.dal.dto.UserIndexGroupLink" schema="PUBLIC">
            <column name="UIGL_USR_ID" property="userId" />
            <column name="UIGL_IGR_ID" property="indexGroupId" />
        </table>
        <table name="APP_USER_INDEX_LINK" class="com.trovare.dal.dto.UserIndexLink" schema="PUBLIC">
            <column name="UIL_USR_ID" property="userId" />
            <column name="UIL_IND_ID" property="indexId" />
        </table>
        <table name="APP_USER_ROLE_LINK" class="com.trovare.dal.dto.UserRoleLink" schema="PUBLIC">
            <column name="URL_USR_ID" property="userId" />
            <column name="URL_ROL_ID" property="roleId" />
        </table>
        <table name="REF_DOC_TYPE" class="com.trovare.dal.dto.DocType" schema="PUBLIC">
            <column name="DT_ID" property="id" />
            <column name="DT_EXTENSION" property="extension" />
            <column name="DT_DESCRIPTION" property="description" />
        </table>
    
    </hibernate-reverse-engineering>
    
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Hibernate Reverse engineering not creating correct classes

You must be logged in to post in the forum log in