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: Creating linked lists, trees, etc. using an interface?
PostPosted: Wed Jan 14, 2009 6:29 pm 
Newbie

Joined: Fri Oct 17, 2008 1:30 pm
Posts: 2
Here is a simple question:

I want to implement a linked list (or a tree or similar) using an interface (actually a trait as I'm coding in Scala) on the individual entity.

In other words, if I have an entity ToDoItems and I want to make it a linked list, then my desire is to simply add a LinkedList interface which will provide the necessary fields and methods to permit such calls as:

toDoItem.moveUp
toDoItem.moveToFirst
toDoItem.hasPrevious

And so forth. To do this, I need to be able to access parent, child, and sibling objects from within the object itself. (For example, moveUp would change the previousId and nextId fields for both the item and the previous item in the list.)

I can see how to do this through a DAO which has a reference to the EntityManager, but I'm not using DAOs in my Scala app. It would be easiest to just add the trait (which, in Scala, can have concrete methods and fields) to the entity.

Any chance of this? Probably not, eh?

Thanks,
Chas. Munat
Seattle


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.