Issue Details (XML | Word | Printable)

Type: Improvement Improvement
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Mike
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Enhancer (ARCHIVED)

Support embedded collections

Created: 31/Aug/11 11:33 PM   Updated: 03/Oct/11 08:28 AM   Resolved: 05/Sep/11 06:59 AM
Component/s: None
Affects Version/s: 3.0.0.release
Fix Version/s: None

Datastore: Other

 Description  « Hide
This code:

public class User {
public List<Stock> stocks;

will result in the following during enhancement:

Field "sw.entity.User.stocks" is of type "java.util.List" yet has been specified as embedded. DataNucleus doesnt support embedding of this type. Your embedded type must be PersistenceCapable. DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors.

A workaround is to change the List type to a concrete PersistenceCapable implementation empty wrapper like this:
public class EmbeddableArrayList<E> extends ArrayList<E> {}
But this is really ugly.

Andy Jefferson added a comment - 01/Sep/11 09:33 AM
DataNucleus has supported embedded of collection *elements* since day one - you are not embedded the Collection here, but the elements. In JDO @Embedded is to persist the whole field, and you can only do that with a persistable object, not a Collection/Map/array, as per the docs

SVN code allows something like
List<MyElement> myList;

Released code requires
List<MyElement> myList;

Andy Jefferson added a comment - 05/Sep/11 06:59 AM
Use aforementioned syntax

Andy Jefferson made changes - 05/Sep/11 06:59 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Won't Fix [ 2 ]
Andy Jefferson made changes - 03/Oct/11 08:28 AM
Status Resolved [ 5 ] Closed [ 6 ]