Hibernate has both object properties and character attributes configured for the same field in the database

Source: Internet
Author: User

The following two mappings are made to the KPI ID in the database in Hibenrnate

<property name= "kpiid" type= "Java.lang.Integer" insert= "false" update= "false";
             <column name= "kpi_id";
                 <comment>kpi Id</comment>
             </column>
         </property>
        <many-to-one name= "KPI" class= " Com.ibm.appMonitor.pojo.TKpi "lazy=" false " ;
             <column name= "kpi_id";
                 <comment>kpi_id</comment>
             </column>
        </many-to-one>


where "Kpiid" indicates insert = ' false ' update = ' false '


So be careful when saving and updating KPIs instead of KPIID


Important: If you are using SQL queries instead of HQL queries, be aware of the first new KPI object when encapsulating objects

Then assign a value to the query object. Otherwise, when you save the update to the database, you will find that kpi_id becomes a null value.

Hibernate has both object properties and character attributes configured for the same field in the database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.