persistence@glassfish.java.net

Re: (TopLink Essentials) bogus _at_JoinTable default value

From: Klaus Unger <UngerKlaus_at_gmx.de>
Date: Mon, 29 Oct 2007 21:33:15 +0100

On Friday 26 October 2007 14:18:38 Gordon Yorke wrote:
> Can you post the source for the mapping along with the SQL that TopLink
> is generating?
> --Gordon

I don't have the SQL here right now but the code is like this:
Do not hesitate to contact me if you are unable to reproduce the problem!
------------------------------
@Entity
public class Element{
        @Id
        @GeneratedValue
        protected Long id;

        @Basic
        protected String name;

        protected Element() {
                super();
        }

        public Element(String name) {
                this.name = name;
        }

        public String getName() {
                return name;
        }
}

@Entity
public class Container {
        @Id
        @GeneratedValue
        protected Long id;
        
        @OneToMany
        protected Collection<Element> elements = new LinkedList<Element>();
        
        public Container() {
                super();
        }
        
        public Element newElement(String name) {
                Element e = new Element(name);
                elements.add(u);
                EntityManagerSingleton.get().persist(u);
                return e;
        }
        
        public Collection<Element> getElements() {
                return elements;
        }
}