-->
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.  [ 2 posts ] 
Author Message
 Post subject: I've a parent with a list of child. I cant delete some child
PostPosted: Tue Sep 23, 2008 7:40 pm 
Newbie

Joined: Tue Sep 23, 2008 7:13 pm
Posts: 1
Hey Guys...
Look That:

I've a Blog (class) and a Post (class).


Post Class:
public int ID { get; set; }
public string Title { get; set; }
public string Category { get; set; }
public string Text { get; set; }
public DateTime Creation { get; set; }
public Blog Blog { get; set; }

Post hbm xml:
<class name="Post" table="EDJPost" >
<id name="ID" column="PostID">
<generator class="native"/>
</id>
<many-to-one name="Blog" class="TranceNET.DomainModel.Blog.Entities.Blog, TranceNET.DomainModel" column="BlogID" cascade="all" />
<property name="Title" not-null="false"/>
<property name="Text"/>
<property name="Category" not-null="false"/>
<property name="Creation"/>
</class>

---------------------------------

Blog Class:
public int ID { get; set; }
public string About { get; set; }
public List<Post> posts { get; set; }

Blog hbm xml:
<class name="Blog" table="EDJBlog" >
<id name="ID" column="BlogID">
<generator class="native"/>
</id>
<property name="About" not-null="false"/>
</class>


Ok, when i try to save one post, no problems appear... it's all right...

BUT

when i try to delete some post, none exception appear but the post dont be deleted.

Look at the image to clarify some why i try to say...

In the image, my object (Post) have one property (Blog) and that property was null... is that the problem?


Image

Image
[/img]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 6:17 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Hmmm ... I can only see a Session.Delete in your code. For the object to be deleted you need to flush the session or commit the transaction (if you use one).

_________________
--Wolfgang


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