These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Doubts in hibernate
PostPosted: Thu Feb 11, 2010 1:03 am 
Newbie

Joined: Thu Feb 11, 2010 12:54 am
Posts: 1
1. is it necessary to create tables with primary key and foreign key while doing one-to-many or many-to-many?

2. How to do joins for two tables, i am getting errors?

3.in which .hbm.xml file we have to use set, map ,bag and one-to- many relationship?

4. DB is MySQL, long type is not takinh the primary key, what should i do?

Can you suggest me a good book regarding basics, how internally it is going, what are the prerequisites to do hibernate like Database creation, tables, and primary key and foreign keys.


Top
 Profile  
 
 Post subject: Re: Doubts in hibernate
PostPosted: Thu Feb 11, 2010 3:52 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
I personally suggest the book 'Java Persistence with Hibernate'. (You should see a link to this book on the top of the page)


Top
 Profile  
 
 Post subject: Re: Doubts in hibernate
PostPosted: Sat Feb 13, 2010 10:43 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
1. is it necessary to create tables with primary key and foreign key while doing one-to-many or many-to-many?


Well, that's sorta how relational databases keep track of relationships. Hibernate doesn't care about the underlying constraints, but really, relational databases are supposed to have keys and constraints.

For a good book on Hibernate that uses MySQL as the database, and teaches good JPA techniques, check out my book "Hibernate Made Easy" My signature links will take you there.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Last edited by Cameron McKenzie on Fri Feb 19, 2010 10:13 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Doubts in hibernate
PostPosted: Sat Feb 13, 2010 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Just to clarify...

Is it *necessary*? No, its not necessary; Hibernate does not care if there are physically constraints defined on the underlying database. Is it an extremely good idea? Abso-smurfly! But this has nothing to do with Hibernate. As Cameron pointed out this is merely good database design.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.