must have same number of columns as the referenced primary key


在使用Hibernate實現多對多的測試過程中遇到了這個問題

解決的方法: 將黃色字段的內容添加進去

        <set name="customerSet" table="orders" cascade="all">
            <key column="goods_id" ></key>
            <many-to-many class="com.bj186.entity.Customer" column="customers_id"></many-to-many>
        </set>

 

問題的原因: 原因是<many-to-many>的配置中, 少了column這個欄的指定


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM