-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping a children objects from the same table
PostPosted: Thu Sep 15, 2011 2:35 pm 
Newbie

Joined: Thu Sep 15, 2011 2:22 pm
Posts: 1
I am trying to map an existing table which looks somewhat like this:

EXTENSION_TABLE (
ID NUMBER,
HEADER VARCHAR2(255),
CONTENT VARCHAR2(2000),
SORT_ORDER NUMBER,
PARENT_KEY NUMBER
)

The bean that I created looks like this:

public class ExtensionBean {
private Integer id;
private String header;
private String content;
private List<ExtensionBean> children;

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

... etc.
}

The way the data is stored, the top level record has a parent key of zero and it's children have the top level's ID in the PARENT_KEY. I have been trying to map this so that when the top level record is read, the children get loaded as well into a List<ExtensioBean>. This is a legacy table which I cannot change.

I haven't had much success so any help/info/guidance that you could provide will be greatly appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.