Issue Details (XML | Word | Printable)

Key: GLASSFISH-538
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: tware
Reporter: mf125085
Votes: 2
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

Infinite loop while processing invalid self relation mapping

Created: 04/Apr/06 04:20 PM   Updated: 06/Mar/12 10:06 PM
Component/s: entity-persistence
Affects Version/s: 9.0pe
Fix Version/s: not determined

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive issue538.zip (9 kB) 04/Apr/06 04:28 PM - mf125085

Environment:

Operating System: All
Platform: All


Issuezilla Id: 538
Tags:
Participants: marina vatkina, mf125085, Tom Mueller and tware


 Description  « Hide

Building the model for a bean having a self referencing relationship, the code
runs into an infinite loop:

[java] [TopLink Config]: 2006.04.04
04:14:13.062-ServerSession(21171036)-Thread(Thread[main,5,main])--The target
entity (reference) class for the one to many mapping element [private
java.util.Set company.Employee.team] is being defaulted to: class company.Employee.
[java] [TopLink Config]: 2006.04.04
04:14:13.078-ServerSession(21171036)-Thread(Thread[main,5,main])--The map key
attribute name for the mapping element
[oracle.toplink.essentials.internal.annotations.AnnotationsAccessor@18088c0] is
being defaulted to: id.
[java] [TopLink Config]: 2006.04.04
04:14:13.109-ServerSession(21171036)-Thread(Thread[main,5,main])--The target
entity (reference) class for the one to many mapping element [private
java.util.Set company.Employee.team] is being defaulted to: class company.Employee.
[java] [TopLink Config]: 2006.04.04
04:14:13.109-ServerSession(21171036)-Thread(Thread[main,5,main])--The map key
attribute name for the mapping element
[oracle.toplink.essentials.internal.annotations.AnnotationsAccessor@18088c0] is
being defaulted to: id.
...



mf125085 added a comment - 04/Apr/06 04:28 PM

Created an attachment (id=197)
Please read the README file for how to run the test.


mf125085 added a comment - 04/Apr/06 05:18 PM

The attached test actually contains an invalid mapping. The mapping for the self
relationship should be:

@OneToMany(cascade=CascadeType.ALL, mappedBy="team")
private Employee manager;

@ManyToOne @JoinColumn(name="MANAGER_ID")
private Set<Employee> team;

The problem described in this issue is that the code gets into the infinite
loop, rather than detecting that the mapping is invalid, and informing the user
about the error.


mf125085 added a comment - 04/Apr/06 05:33 PM

The correct relationship mapping is:

@ManyToOne @JoinColumn(name="MANAGER_ID")
private Employee manager;

@OneToMany(cascade=CascadeType.ALL, mappedBy="manager")
private Set<Employee> team;

This annotation is correctly processed by toplink code. Sorry for the confusion.


marina vatkina added a comment - 04/Apr/06 05:42 PM

The exception should be thrown instead of an infinite loop.


marina vatkina added a comment - 04/Apr/06 06:23 PM

The exception should be thrown instead of an infinite loop.


marina vatkina added a comment - 12/Feb/07 05:26 PM

resetting the default owner


Tom Mueller added a comment - 06/Mar/12 10:06 PM

Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.