Vous êtes sur la page 1sur 2

Example of Many to Many Mapping in Hibernate by Map using xml file - javatpoint Page 1 of 2

Javascript | Ajax | Jaxb | JUnit Hi, biswojit.mohapatra@yahoo.com| 0 | 0 | 0 | 0 | Profile | logout Write-For-Us |

+91-9990449935
Development | Training | SEO | Consultancy
JavaTpoint 0120-4256464
Subscribe

Home Core Java Servlet JSP Struts2 Mail API Hibernate Spring Android Design Pattern Quiz Projects Interview Q Comment Forum

Basics of Hibernate
HB Introduction
HB Architecture
Understanding First HB
application ► Hibernate Java ► Hibernate Mapping ► Hibernate SQL ► Hibernate 3.0
Hibernate with IDE
<<prev next>>
HB in Eclipse
HB in MyEclipse
Many to Many Mapping in hibernate by map
Hibernate Application Example (using xml file)
HB with annotation
HB Web application We can map many to many relation either using set,
HB Generator classes bag, map etc. Here, we are going to use map for many Many to Many Mapping
HB Dialects -to-many mapping. In such case, three tables will be Example of Many to Many Mapping
Hibernate Logging created.

HB with Log4j 1
HB with Log4j 2 Example of Many to Many Mapping
Inheritance Mapping
Table Per Hierarchy You need to create following pages for mapping map elements.
TPH using Annotation
• Question.java
Table Per Concrete
• User.java
TPC using Annotation
• question.hbm.xml
Table Per Subclass
• user.hbm.xml
TPS using Annotation
• hibernate.cfg.xml
Collection Mapping
• StoreTest.java
Mapping List
• FetchTest.java
One-to-many by List
OTM Annotation
Question.java
Mapping Bag
package
One-to-many by Bag com.javatpoint;
Mapping Set
One-to-many by Set User.java
Mapping Map package
Many-to-many by Map com.javatpoint;
Bidirectional
Lazy Collection question.hbm.xml

Component Mapping <?xml version='1.0'


encoding='UTF-8'?>
Association Mapping
One-to-one 1
user.hbm.xml
One-to-one 2
<?xml version='1.0'
Tx Management encoding='UTF-8'?>
HQL
HCQL hibernate.cfg.xml

Named Query <?xml version='1.0'


encoding='UTF-8'?>
Hibernate Caching
Second Level Cache StoreTest.java
Integration package
Hibernate and Struts com.javatpoint;
Hibernate and Spring
FetchTest.java
package
com.javatpoint;

download this hibernate example(developed using MyEclipse IDE)


Next Topic Bidirectional Association

<<prev next>>

► Hibernate 3.0 ► Eclipse Hibernate ► Hibernate Driver ► XML for Java

Tweet

http://www.javatpoint.com/many-to-many-mapping-in-hibernate-by-map-example 4/16/2014
Example of Many to Many Mapping in Hibernate by Map using xml file - javatpoint Page 2 of 2

Like the www.javatpoint.com on facebook / subscribe to get latest updates Blog

Tutorials Forum Interview Ques.

Core Java Tutorial Core Java Ques. Core Java


Servlet Tutorial Servlet Ques. Servlet
JSP Tutorial JSP Ques. JSP
Mail API Tutorial Struts Ques.
Design Pattern Tutorial Spring Ques. Projects
Struts 2.0 Tutorial Hibernate Ques.
Spring 3.0 Tutorial Android Ques. Free Java Projects
Hibernate Tutorial
Android Tutorial SSS IT PVT LTD Quizzes
JavaScript Tutorial
SQL Tutorial Development Core Java quiz
C Tutorial Training Servlet quiz
AJAX Tutorial SEO JSP quiz
JUnit Tutorial Consultancy Struts2 quiz
JAXB Tutorial Android quiz
Maven Tutorial
OCJP/SCWCD quiz

CONTACT US
Tel. : 0120-4256464
Mob. : +91 9990449935
Email : enquiry@sssit.org

Address: Plot - 6, GT Road,


Near MMX Mall,
Mohan Nagar, Ghaziabad,
201007, UP, India

© 2011-2013 Javatpoint.
All Rights Reserved.

http://www.javatpoint.com/many-to-many-mapping-in-hibernate-by-map-example 4/16/2014

Vous aimerez peut-être aussi