-->
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: ManyToMany-Stack overflow and Multiple bag errors
PostPosted: Mon Oct 18, 2010 2:37 pm 
Newbie

Joined: Fri Oct 15, 2010 12:31 pm
Posts: 2
Hi ,

I am facing issues while retrieving data for entities having bi-directional manytomany relationship. If I use List for storing entities , i get unable to fetch multiple bags simultaneously error. If i change my code to use Set , i get stackoverflow error.

Details :

Spring 3.0.3
Hibernate-core : 3.5.1-Final
Hibernate-annotations : 3.5.1-Final
hibernate-common-annotations : 3.2.0-Final
hibernate-entitymanager : 3.5.1-Final
Mysql database
Junit 4

User has Many Bank Accounts
Bank Account can have many users

User.java

@ManyToMany(fetch = FetchType.EAGER, mappedBy="user")
private List<BankAccount> bankAccounts = new ArrayList<BankAccount>();

BankAccount.java

ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "user_bankaccount", joinColumns = @JoinColumn(name ="bank_account_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
private List<User> user = new ArrayList<User>();

DB Tables

Users
user_id PK

Bankaccount
bank_account_id PK


user_bankaccount
bank_account_id PK ( references bankaccount.bank_account_id )
user_id PK ( references user.user_id )


issues

1. when i try to get all the users data (getAllUsers) using a junit testcase, i get unable to fetch multiple bags simultaneously error.
2. If I use Set and HashSet instead of List and ArrayList respectively, i get stackoverflow error.

Please help me and let me know if code is wrong or its a known hibernate issue with specific version of libs that i am using.

Thank you.


Top
 Profile  
 
 Post subject: Re: ManyToMany-Stack overflow and Multiple bag errors
PostPosted: Tue Oct 26, 2010 2:56 am 
Newbie

Joined: Fri Oct 15, 2010 12:31 pm
Posts: 2
I have added JIRA for this issue.

http://opensource.atlassian.com/projects/hibernate/browse/HHH-5691

I have also attached complete source code zip at the above url.


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.