-->
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.  [ 2 posts ] 
Author Message
 Post subject: Why table in @CollectionTable doesn't need a config entry
PostPosted: Mon Jun 27, 2016 10:02 pm 
Newbie

Joined: Sat Jun 25, 2016 5:58 pm
Posts: 3
So, I have a collection of basic type (String) that corresponds to a child table in the database. In my parent entity class I specify as follows
Code:
@CollectionTable(name="BANK_CONTACT", joinColumns=@JoinColumn(name="BANK_ID"))


Why is it that I don't need an entry for BANK_CONTACT in hibernate.cfg.xml?
Thanks!


Top
 Profile  
 
 Post subject: Re: Why table in @CollectionTable doesn't need a config entry
PostPosted: Tue Jun 28, 2016 5:00 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
@ElementCollection allows you to map value objects, not entities. The underlying table is managed automatically by Hibernate, just like in any unidirectional association.

However, a bidirectional @OneToMany association performs better than any unidirectional collection or @ElementCollection.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.