Skip to main content

StackOverflow on OneToOneMapping ?

6 replies [Last post]
bjb
Offline
Joined: 2003-06-12

Hi all,
I've encountered the following on a b32 :

[#|2005-12-28T10:27:02.937+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=13;_ThreadName=Thread-27;_RequestID=d148a7f4-ee64-4c46-9ccb-80a52a67c110;|Exception occured in J2EEC Phase
java.lang.StackOverflowError
at oracle.toplink.essentials.internal.helper.DatabaseField.equals(DatabaseField.java:144)
at oracle.toplink.essentials.internal.helper.DatabaseField.equals(DatabaseField.java:167)
at java.util.Hashtable.get(Hashtable.java:339)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:375)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
...
(the rest is cut as it is the same line looping forrever)

The issue is that it does not say on analysing which mapping this is happening, so I can not build easilly a simple test case to identify if this is a problem with my code that I need to correct or a bug to track&fix.

Any ideas on this overflow ?

Rgs,
JB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
guypelletier
Offline
Joined: 2005-10-19

Hi JB,

Would it be possible for you to post some snippets from your model with 1-1 mappings? Does your model have a lot of 1-1's mappings? When does this error occur exactly, deploy? Just trying to narrow it down ...

We have not seen this issue, but perhaps you could open an issue in glass fish anyway so it can be looked into further?

Cheers,
Guy

bjb
Offline
Joined: 2003-06-12

Hi Guy,

Finally I manage to limit the issue to some small class :

package test;
import javax.persistence.Entity;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.OneToOne;

@Entity
public class Master {

private Master parent;

private Long id;

@Id(generate = GeneratorType.AUTO)
@Column(updatable=false,nullable=false,unique=true,insertable=false)
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@OneToOne
public Master getParent() {
return parent;
}

public void setParent(Master parent) {
this.parent = parent;
}
}

Trying to deploy this on b32 with a usual EAR (and a default persistence unit created by netbeans) and you get :

[#|2006-01-09T21:28:45.234+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=13;_ThreadName=Thread-30;_RequestID=32120301-a241-4ffb-a8c8-b25c534d5b75;|Exception occured in J2EEC Phase
java.lang.StackOverflowError
at oracle.toplink.essentials.internal.helper.DatabaseField.hashCode(DatabaseField.java:260)
at java.util.Hashtable.get(Hashtable.java:336)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:375)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
at oracle.toplink.essentials.mappings.OneToOneMapping.getFieldClassification(OneToOneMapping.java:383)
....

I realy thought that unidirectional 1-1 is part of the spec (see §2.1.8.3.1 of EJB3 spec persistence PFD), and I did not see any limitation such as self-relationship ...

Can you clarify this ?

Best Regards,
JB

guypelletier
Offline
Joined: 2005-10-19

Hi JB,

Yes section 2.1.8.3.1 is one area that is currently being addressed (implementation wise). The current code was written to support the Public draft and work is underway as we speak to support this section of the PFD.

Just a shot in the dark though, I wonder if the defaulting on the 1-1 is causing this. Try specifying the name attribute on the one to one (that is name=PARENT_ID).

If that doesn't help I can certainly look into this problem further now that I have your model class to work with.

Cheers,
Guy

guypelletier
Offline
Joined: 2005-10-19

"Try specifying the name attribute on the one to one (that is name=PARENT_ID)." .. via a JoinColumn is what I meant ... sorry long day.

bjb
Offline
Joined: 2003-06-12

Thanks a lot Guy ! This has fixed the problem ...

Should I raise an issue for this one ?

I do hope next milestone will bring correct defaultings as per PFD to save us from "work-around" headaches ;-)

Regards,
JB

guypelletier
Offline
Joined: 2005-10-19

HI JB,

Glad that fixed the problem! As I mentioned before this fix is currently underway and very near completion so you should see an update very soon. Yes raising an issue is fine, you can therefore track the progress of the fix and be notified when it is completed.

Cheers,
Guy