-->
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.  [ 3 posts ] 
Author Message
 Post subject: delete cascade parent child not working (with Oracle DB)
PostPosted: Tue Jan 24, 2006 5:01 am 
Newbie

Joined: Mon Oct 10, 2005 1:55 pm
Posts: 12
hi all
i try to delete parent and its 2 childs using the folowing mappings
int the parent:

<bag name="Child1" access="field" table ="IntChild1" inverse="true" cascade="all-delete-orphan">
<key column="IntParentOIID"/>
<one-to-many class="Child1"/>
</bag>



<bag name="Child2" access="field" table ="IntChild2" inverse="true" cascade="all-delete-orphan">
<key column="INTPARENTOIID"/>
<one-to-many class="Child2"/>
</bag>

in the childs (both of them)
<many-to-one name="Parent" column="PARENTOIID" class ="Parent" />

the insert, update are working correctly
but i have problem with the delete i have got NO error from Nhibernate its just stucks when deleting
Thanks alot


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 7:17 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Please fill in the template you were asked to fill when posting. The information you gave is not enough (in particular, what do you mean by "stuck when deleting" - deleting what?)

Also, two one-to-many's in Child1 and Child2 with both set to inverse="true" look strange. Shouldn't they be many-to-many's with only one of them set to inverse="false"?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 8:20 am 
Newbie

Joined: Mon Oct 10, 2005 1:55 pm
Posts: 12
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:1.0.0.0

Mapping documents: the row which i mentioned

Code between sessionFactory.openSession() and session.close():


#region Constructor
public DBScope(TransactionOption option)
{
if (session == null)
{
session = sessionFactory.OpenSession();
m_isSessionOwner = true;
}

if ((tx == null) && (option == TransactionOption.On))
{
tx = session.BeginTransaction();
m_isTxOwner = true;
}
}

#endregion

#region IDBScope Members
void IDBScope.Complete()
{
m_isComplete = true;
}
#endregion

#region IDisposable Members

public void Dispose()
{
if (m_isTxOwner && (tx != null))
{
if (m_isComplete)
tx.Commit();
else
tx.Rollback();

tx = null;
m_isTxOwner = false;
}

if (m_isSessionOwner && (session != null))
{
if (m_isComplete)
session.Flush();

session.Dispose();

session = null;
m_isSessionOwner = false;
}

GC.SuppressFinalize(this);
}

#endregion

#region private members
private bool m_isSessionOwner = false;
private bool m_isTxOwner = false;
private bool m_isComplete = false;
#endregion

#region static

#region public






Name and version of the database you are using:Oracle 10g

hope it will be enough
i will check about the "inverse" issue
i have one parent with 2 childs - the childs are not connection tables (many to many) - its 2 different one to many connections

thnks


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