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