2

I have written my own java.util.List implementation, and now i want to store it in a MySQL using DataNucleus. My implementation consists of a public class that implements the List interface, and a private class that implements the node for that list.

When I run the SchemaTool in Eclipse, only the table for my Node implementation gets created, and when i run my app, i get the following error:

Persistent class "a.b.c.util.DtvList" has no table in the database, but the operation requires it. Please check the specification of the MetaData for this class.

Here's the beginning of my List implementing class...

@PersistenceCapable
@Inheritance(strategy=InheritanceStrategy.COMPLETE_TABLE)
public class DtvList<E extends Comparable<E>> implements List {
    @Persistent
    private DtvListNode first = null;
    private DtvListNode last = null;
    private int length = 0;
    public DtvList(){};

Also, i only have an implementation for the add(E object) method, all the other methods throw a RuntimeException. Could that be the problem?

PS I also tried implementing some more methods, such as getIterator and others, and I even tried writing a mapping plugin (http://www.datanucleus.org/extensions/rdbms_java_types.html), but to no avail. The TABLE does not get created by the SchemaTool in the database.

PS/2 Added the Mapping class for the DtvListNode implementation, now i have a table for the DtvList, but not for the DtvListNode. It is still not working. But i still get the exception org.datanucleus.store.exceptions.NoTableManagedException that the DtvList table does not exist.

Ibolit
  • 9,218
  • 7
  • 52
  • 96

1 Answers1

1

I don't think DataNucleus supports custom List implementation for mapping relationships.

If you Lists are small in size and your implementation can support a copy constructor and to List(), you could map a standard List and implement LoadCallback and StoreCallback to manage the conversion. Obviously if you have a lot of persistent operations on that List, it will get rather messy...

TheArchitect
  • 2,161
  • 1
  • 12
  • 16