Home » Hibernate Tutorial: Mapping Map in Collection Mapping

Hibernate Tutorial: Mapping Map in Collection Mapping

by Online Tutorials Library

Hibernate Mapping Map using xml file

Hibernate allows you to map Map elements with the RDBMS. As we know, list and map are index-based collections. In case of map, index column works as the key and element column works as the value.

Example of Mapping Map in collection mapping using xml file

You need to create following pages for mapping map elements.

  • Question.java
  • question.hbm.xml
  • hibernate.cfg.xml
  • StoreTest.java
  • FetchTest.java

Question.java


question.hbm.xml

hibernate.cfg.xml

StoreTest.java

Output

Hibernate Mapping Map Example 1 Hibernate Mapping Map Example 2

FetchTest.java

Output

Hibernate Mapping Map Example 3

Download

Next TopicOne to Many XML

You may also like