-->
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.  [ 11 posts ] 
Author Message
 Post subject: stack overflow
PostPosted: Fri May 14, 2004 5:53 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
hi all,

I had a short query about a problem. I'am using hibernate 2.1 and xdoclet 1.2. And all goes fine. I define an one-many and become a stack overflow wenn i want to access from the child the parent.

example:

Parent:
Collection getChild();

Child:
Parent getChild();

when I call parent.getChild(); all goes fine but when I call child.getParent() I become the stackoverflow exception.

I think the problem that hibernate calls intern:

getChildren -> getParent -> getChildren -> getParent and so one?

how to deal with this problem?

XDoclet definition:

Child:


/**
* @hibernate.many-to-one cascade = "none" column = "`bin_id`" * @return
*/
public Bin getBin() {
return bin;
}


Parent:

/**
* @hibernate.set lazy="true" cascade = "none"
* @hibernate.collection-one-to-many
* @hibernate.collection-key column = "`bin_id`"
*/
public Collection getAnotatedSpectra() {
return anotatedSpectra;
}


whats my mistake? And this feature is realy importent!

bye and many thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 8:24 am 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
is nobody here who can help me with this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 8:26 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
inverse="true"

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 8:45 am 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
thanks, i test this this afternoon


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 2:38 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
sorry, but at whitch point must i set inverse = true?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 2:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read the documentation, "Parent/Child Relationship".

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:03 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
what do you think? im reading the manual and the xdoclet part is a little bit to small, i also read xdoclet in action and it does not help.

the inverse parameter is descriped at chater 6.2, 6.4 and 14.1.3 and there is no explanation


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.hibernate.org/?cmd=srchdoc&q=inverse

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:09 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
ups,

sorry i read the fat manual


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:11 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I was talking about that too, but since the "Parent/Child Relationship" chapter didn't help you, suggested a search.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 3:42 pm 
Beginner
Beginner

Joined: Tue May 11, 2004 12:08 pm
Posts: 38
Location: Davis,CA,USA
ok I read the parts and test this but i become an stack overflow exception again. But all files look good...

bin.hbm.xml

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.bin.Bin"
table="`gwBIN`"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="`bin_id`"
type="int"
>
<generator class="native">
</generator>
</id>

<property
name="apexSn"
type="double"
update="false"
insert="false"
column="`apex_sn`"
/>

<property
name="purity"
type="double"
update="false"
insert="false"
column="`purity`"
/>

<property
name="retentionIndex"
type="int"
update="false"
insert="false"
column="`retention_index`"
/>

<property
name="sampleId"
type="int"
update="false"
insert="false"
column="`sample_id`"
/>

<property
name="spectraId"
type="int"
update="false"
insert="false"
column="`spectra_id`"
/>

<property
name="uniqueMass"
type="int"
update="false"
insert="false"
column="`uniquemass`"
/>

<many-to-one
name="sample"
class="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.Sample"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="`sample_id`"
/>

<property
name="apexSpec"
type="java.sql.Clob"
update="false"
insert="false"
column="`apex`"
/>

<property
name="massSpec"
type="java.sql.Clob"
update="false"
insert="false"
column="`spectra`"
/>

<set
name="anotatedSpectra"
lazy="true"
inverse="true"
cascade="none"
sort="unsorted"
>

<key
column="`bin_id`"
/>

<one-to-many
class="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.spectra.Spectra"
/>
</set>

<property
name="export"
type="java.lang.String"
update="false"
insert="false"
column="`export`"
/>

<property
name="generateQuantMass"
type="java.lang.String"
update="false"
insert="false"
column="`generatequantmass`"
/>

<property
name="minusRange"
type="int"
update="true"
insert="false"
column="`minus`"
/>

<property
name="newBin"
type="java.lang.String"
update="true"
insert="false"
column="`new`"
/>

<property
name="plusRange"
type="int"
update="true"
insert="false"
column="`plus`"
/>

<property
name="quantMass"
type="int"
update="true"
insert="false"
column="`quantmass`"
/>

<property
name="standard"
type="java.lang.String"
update="true"
insert="false"
column="`standard`"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Bin.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

spectra.hbm.xml

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.spectra.Spectra"
table="`SPECTRA`"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="`spectra_id`"
type="int"
>
<generator class="native">
</generator>
</id>

<property
name="apexSn"
type="double"
update="false"
insert="false"
column="`apex_sn`"
/>

<property
name="purity"
type="double"
update="false"
insert="false"
column="`purity`"
/>

<property
name="retentionIndex"
type="int"
update="false"
insert="false"
column="`retention_index`"
/>

<property
name="sampleId"
type="int"
update="false"
insert="false"
column="`sample_id`"
/>

<property
name="similarity"
type="double"
update="false"
insert="false"
column="`simialrity`"
/>

<property
name="uniqueMass"
type="int"
update="false"
insert="false"
column="`uniquemass`"
/>

<many-to-one
name="sample"
class="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.Sample"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="`sample_id`"
/>

<many-to-one
name="bin"
class="de.mpg.mpimp.golm.binbase.bellerophon.model.impl.hibernate.experiment.sample.bin.Bin"
cascade="none"
outer-join="auto"
update="false"
insert="false"
column="`bin_id`"
/>

<property
name="apexSpec"
type="java.sql.Clob"
update="false"
insert="false"
column="`apex`"
/>

<property
name="massSpec"
type="java.sql.Clob"
update="false"
insert="false"
column="`spectra`"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Spectra.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>


I can't see any failures and wonder why I ever become a stack overflow exception when I acces the paren object (Bin) from the child (spectra)


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