[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-5691) JPA with Hibernate 3 - ManyToMany-Stack overflow and Multiple bag errors

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Oct 27 09:40:50 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-5691.
-------------------------------

    Resolution: Rejected

Hibernate has no control over what you do in your toString() methods

> JPA with Hibernate 3 - ManyToMany-Stack overflow and Multiple bag errors
> ------------------------------------------------------------------------
>
>                 Key: HHH-5691
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5691
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.1
>         Environment: 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
>            Reporter: Suyash Kaulgud
>         Attachments: fms-web.zip
>
>
> I am facing issues while retrieving data for entities having bi-directional many-to-many 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
> when I try to get all the users data (getAllUsers) using a JUnit test case, I get unable to fetch multiple bags simultaneously error.
> If I use Set and HashSet instead of List and ArrayList respectively, I get stackoverflow error.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list