Brennan Spies-3 wrote:
>
> Is there a good example of how to do this (custom collections with EAGER
> loading)? My code is like so:
>
> public interface Stack<E>
> {
> /**
> * Removes the top of the stack and returns it.
> * @return The item at the top of the stack
> * @throws EmptyStackException If the stack is empty
> */
> public E pop() throws EmptyStackException;
> /**
> * Pushes an item onto the stack.
> * @param item The item to push onto the stack
> * @return The item added, or null if item could not be added
> */
> public E push(E item);
>
> //etc....
> }
>
> The primary implementation simply wraps an ArrayList:
>
> public class ArrayStack<E> implements Stack<E>, Cloneable
> {
> private List<E> list;
> public ArrayStack() {
> list = new ArrayList<E>();
> }
> private ArrayStack(List<E> list) {
> this.list = list;
> }
>
> //etc....
> }
>
> I don't actually want to extend the Collection interface, as that contains
> methods I don't want Stack<E> to have.
>
>
> On Wed, Nov 16, 2011 at 10:40 AM, James Sutherland
> <
jamesssss@xxxxxxxxx>wrote:
>
>>
>> What is it a collection of?
>>
>> EclipseLink allows collection implementations is you use EAGER on the
>> mapping. LAZY is not supported with implementation because it requires
>> the
>> interface to allow EclipseLink to use its own lazy collection
>> implementation.
>>
>> I don't think trying to make is an Embeddable is what you want... perhaps
>> include your code.
>>
>>
>>
>> Brennan Spies-3 wrote:
>> >
>> > Hi all,
>> >
>> > I'm a bit new to EclipseLink, and am struggling to figure out a way to
>> use
>> > a custom collection: a custom Stack interface with a standard
>> > implementation, ArrayStack, that simply wraps a java.util.List. As a
>> first
>> > go, I've specified the ArrayStack as being @Embeddable, and mapped the
>> > list
>> > directly using @ElementCollection. But EclipseLink needs a
>> "targetClass"
>> > to
>> > do that, but I don't want to specify it in the @Embeddable directly
>> since
>> > I
>> > am using it in more than one entity type.
>> >
>> > Is there an EclipseLink-specific way to override the "targetClass" on
>> this
>> > List, or a way to do this using a DescriptorCustomizer?
>> >
>> >
>>
>
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink ,
http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki:
http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums:
http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book:
http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
Blog:
http://java-persistence-performance.blogspot.com/ Java Persistence
Performance
--