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
|