-->
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: "recursive" Mapping?!
PostPosted: Sat May 06, 2006 7:02 am 
Newbie

Joined: Sat May 06, 2006 6:54 am
Posts: 1
Hi Forum,

i've got an class like:

class Category {

private List<Category> subcategories = new ArrayList<Category>();

// get - setter usw

}

So i try to map this list with this:

<list name="subcategories" table="CATEGORIE_CATEGORIES"
lazy="true" cascade="all-delete-orphan">
<key column="CATEGORIE_ID"></key>
<index column="SUBCATEGORIE_ID" />
<one-to-many
class="mein.package.Category" />
</list>

but this ends in:

(util.JDBCExceptionReporter 71 ) SQL Error: 0, SQLState: null
(util.JDBCExceptionReporter 72 ) failed batch
(def.AbstractFlushingEventListener 299 ) Could not synchronize
database state with session

So i read in the Documentation:
"5.3. Mapping a class more than once"
But this is not really what i need. I need a real rekursiev mapping.
Categorie that can have Categories, where each contains Categories, and so on.
In this example, they declare only one parent-child situation.

What's the solution for my problem?

Tanks for help, and sorry for my english ;)


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 6:42 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
This is possible, I wrote an example about this in my book. May be there is a limitation in your db. Try to save the first categorie before saving the others.

Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.