Get all updates of Java4s

Hibernate Many To Many Mapping Using Annotations

Hibernate » On Sep 3, 2011 By Sivateja

Let us see the example on many to many using annotations

Files required….

  • Categories.java
  • Item.java
  • hibernate.cfg.xml
  • ForOurLogic.java

Categories.java

Item.java

hibernate.cfg.xml

ForOurLogic.java

Eclipse Output

In the database

Java4s_Author
Java/J2EE Developer & Web Designer, founder of Java4s.com. Sign-up for the email newsletter for your daily dose of Java tutorials.
Email: sivateja@java4s.com

Comments

3 Responses to “Hibernate Many To Many Mapping Using Annotations”
  1. sudhakar says:

    Hi java4s,
    This is sudhakar. Greetings for Java4s site maintained holders. This site is very useful for java developers. everything mentions and code display process very brilliant. so I like it this site. my desire was this site maintained very long time and using update technology put in the site for java developers and one more thing best wishes for future implements tickets.

    Thanks & Regards
    Sudhakar

  2. sammaiah says:

    Difference between GenerationType.AUTO and GenerationType.SEQUENCE

  3. Manikandan says:

    Hi java4s,

    I got this error while running your code,

    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    Exception in thread “main” org.hibernate.MappingException: Unknown entity: com.bean.Categories
    at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:489)

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Recomandded Links Current & UpComing Tutorials
Upcoming
  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.