Hibernate many-to-many Associations

Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">Construction of Many-to-many Tables</span></p></p><p><p>650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/83/CF/wKioL1d87xPggvdzAAAwpa3N7NE022.jpg "title=" 1 "alt= "wkiol1d87xpggvdzaaawpa3n7ne022.jpg"/></p></p><p><p><br></p></p><p><p><br></p></p><p><p>In the Java class</p></p><p><p>650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/83/CF/wKioL1d871rTAFW6AAAnotK1jjg172.jpg "title=" 36020160706194558725.jpg "alt=" wkiol1d871rtafw6aaanotk1jjg172.jpg "/></p></p><p><p><strong><span style="font-family:‘宋体‘;font-size:14px;">Many-to-many</span></strong></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">1<span style="font-family:‘宋体‘;">. Relationship Operation</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">1<span style="font-family:‘宋体‘;">, many to many, who operating efficiency are the same</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">2<span style="font-family:‘宋体‘;">. Release the relationship</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">Delete one row of data from the third table</span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">3<span style="font-family:‘宋体‘;">. Establishing a Relationship</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">Add data from the third table to a single line of records</span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">4<span style="font-family:‘宋体‘;">. Change of relationship</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">Delete First and then add</span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">2<span style="font-family:‘宋体‘;">. Cascade Operation</span></span></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;">are objects that operate on a collection</span></p></p><p><p><strong><span style="font-family:‘宋体‘;font-size:14px;">Example</span></strong></p></p><p><p><span style="font-family:‘宋体‘;font-size:14px;"></span></p></p><p><p><strong><span style="font-family:‘宋体‘;font-size:14px;">Tool class</span></strong></p></p><pre class="brush:java;toolbar:false"><pre class="brush:java;toolbar:false">public class Hibernateutils {public static Sessionfactory sessionfactory;    public static String url;        @Before public void init () {configuration configuration = new configuration ();        If (url==null) {configuration.configure ();        }else{configuration.configure (url); } sessionfactory = Configuration.buildsessionfactory ();}</pre></pre><p><p><span style="font-family:‘宋体‘;font-size:14px;"></span></p></p><p><p> <strong> <span style="font-family: ' The song Body '; font-size:14px;">student<span style="font-family: ' Arial ';"> map file </span> </span></strong></p></p><pre class="brush:xml;toolbar:false"><?xml version= "1.0"  encoding= "utf-8"? ><! doctype hibernate-mapping public  "-//hibernate/hibernate mapping dtd 3.0//en" " HTTP://HIBERNATE.SOURCEFORGE.NET/HIBERNATE-MAPPING-3.0.DTD ">

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.