JBoss Community

Re: How to get db column comments with Hibernate reverse engineering?

created by vova surkov in JBoss Tools - View the full discussion

Thanks it's worked!!! By it is another problem...It lost code page...I have Oracle UTF8 database and i use russian letters in comments. How can a resolve it ?

 

Here is generated comments (((....

 

/**

           * ���������� �05.������� ������������

           */

          private RefAccreditationDomain refAccreditationDomain;

 

 

my Hibernate.cfg.xml

 

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

<!DOCTYPE hibernate-configuration PUBLIC

                    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

                    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

        <property name="hibernate.connection.password">a</property>

        <property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.11.237:1521:devorcl</property>

        <property name="hibernate.connection.username">ACRED</property>

        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>       

        <property name="hibernate.connection.useUnicode">true</property>       

                    <property name="hibernate.connection.characterEncoding">UTF-8</property>

                    <property name="hibernate.connection.charSet">UTF-8</property>

    </session-factory>

</hibernate-configuration>

 

 

 

and my PojoFields.ftl

 

<#foreach field in pojo.getAllPropertiesIterator()>

          <#if pojo.getMetaAttribAsBool(field, "gen-property", true)>

                    <#foreach column in field.columnIterator>

                    <#if column.comment?exists && column.comment?trim?length!=0>

                    /**

                     * ${column.comment}

                     */

                    </#if>

                    </#foreach>                                                                                                              

                    ${pojo.getFieldModifiers(field)} ${pojo.getJavaTypeName(field, jdk5)} ${field.name}

                    <#if pojo.hasFieldInitializor(field, jdk5)>

                              = ${pojo.getFieldInitialization(field, jdk5)}

                    </#if>;

          </#if>

</#foreach>

Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community