Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM> wrote: Jeff,
I am trying to understand what change actually worked and what is the
*real* bug vs. work around:
0. List failed with message "String is not an entity": This is a
bug in TopLink Essential. It should say List is not Serializable.
sorry, are you saying that the bug is that the error message is wrong, or the bug is that List<String> should work and isn't?
1. "@Basic List ..." failed with SQLException: This is a bug in
TopLink Essential for the same reason as earlier.
i don't really know how to use the @Basic annotation. i tried just putting "@Basic" on the line before the accessors (getters/setters), and that resulted in the SQLException.
2. "@Basic ArrayList ..." worked.
no, just using ArrayList in place of List worked, no @Basic annotation. i didn't try it w/ @Basic.
3. Have you tried "ArrayList ..." (i.e. without @Basic)? This
should work as @Basic is optional for a Serializable field type. If it
does not work, then there is another bug in TopLink Essential.
yes as indicated above, that worked.
Since it is a requirement of the JPA spec that you use a Serializable
type with @Basic, I won't consider changing from List to
ArrayList to be a work around; that is a permanent change in
your code.
okay ... to be clear,
1. i had expected List<String> to just work. it's a bug that it doesn't
2. @Basic List<String> is not expected to work, as the type must be serializable if @Basic is present
3. @Basic ArrayList should work also.
3b. using ArrayList should also work (as it does), as @Basic is optional for serializable types
is this correct?
thanks.
Thanks,
Sahoo
jeff wrote:
> no guy, i missed that. changing to a concrete type works around it for
> now, as sahoo suggested.
>
> thank you again.
>
> */Guy Pelletier /* wrote:
>
> Jeff,
>
> Did you make the change from List to ArrayList (or some other list
> implementation) like Sahoo mentioned?
>
> Cheers,
> Guy
>
> ----- Original Message -----
> *From:* jeff
> *To:* persistence_at_glassfish.dev.java.net
>
> *Sent:* Thursday, March 01, 2007 2:46 PM
> *Subject:* Re: field of type List
>
> thank you guy,
>
> can you give more information on how i should be using this?
> just applying @Basic with no parameters results in a different
> exception ...
>
> adding the @Basic annotation to the getter and setter resulted
> in a different exception:
> Internal Exception: java.sql.SQLException: Type is not
> supported.Error Code: 20000
> Call:INSERT INTO PAGE (ID, PORTLETENTITYIDS, LAYOUT) VALUES
> (?, ?, ?)
> bind => [foo, [x, y, z], [B_at_50818a]
>
> i couldn't find any examples in the java ee tutorial on using
> that annotation.
>
> ?
>
> thanks!
>
> */Guy Pelletier /* wrote:
>
> Jeff,
>
> I have re-opened the bug for further investigation. In the
> mean time, you
> can explicitly mark the accessor with @Basic to get past
> this exception.
>
> Cheers,
> Guy
>
> ----- Original Message -----
> From: "Sanjeeb Kumar Sahoo"
> To:
> Sent: Wednesday, February 28, 2007 11:44 PM
> Subject: Re: field of type List
>
>
> > Hi Jeff,
> >
> > Your issue is related to issue #1327. It is fixed in the
> version of
> > TopLink Essentials you are using. Although that issue is
> marked as fixed,
> > I don't think it is entirely fixed. Had it been the
> case, as reported in
> > that bug, you should have got a validation error that
> says something like:
> > /List is not Serializable/; and if you used LinkedList or
> > some other List implementation that is serializable,
> your program should
> > have worked.
> >
> > You can reopen that bug or file a new one.
> >
> > Thanks,
> > Sahoo
> >
> > jeff wrote:
> >> hi sanjeeb, thanks for your response,
> >>
> >> i'm using the standalone distribution from glassfish,
> toplink essentials
> >> 2.0-36, which was the latest as of a few days ago.
> >>
> >> is there an issue submitted for this? should i submit a
> new one?
> >> thanks.
> >>
> >> */Sanjeeb Kumar Sahoo /* wrote:
> >>
> >> This is a bug in the persistence provider that thinks
> List is a
> >> collection of entities. I presume you are using
> GlassFish persistence
> >> provider. What version are you using?
> >>
> >> Thanks,
> >> Sahoo
> >> jeff wrote:
> >> > i have an entity class w/ a field of type List, it
> looks like
> >> > this:
> >> >
> >> > @XmlElementWrapper (
> >> > name = "portlet-entity-ids",
> >> > nillable = false
> >> > )
> >> > @XmlElement (
> >> > name = "portlet-entity-id"
> >> > )
> >> > private List portletEntityIds;
> >> >
> >> > when i attempt to persist this class, i get an
> exception ...
> >> >
> >> > Exception Description: [class
> com.sun.portal.pom.Page] uses a
> >> > non-entity [class java.lang.String] as target entity
> in the
> >> > relationship attribute [public java.util.List
> >> > com.sun.portal.pom.Page.getPortletEntityIds()].
> >> >
> >> > i tried declaring java.lang.String in my PU just to
> see what
> >> happened,
> >> > and it did not like that either (said it couldn't
> find the class
> >> > actually).
> >> >
> >> > am i missing something?
> >> > thanks!
> >> >
> >> >
> >>
> ------------------------------------------------------------------------
> >> > Bored stiff?
> >> > Loosen up...
> >> > Download and play hundreds of games for free
> >> > on Yahoo!
> >> > Games.
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >> Want to start your own business? Learn how on Yahoo!
> Small Business.
> >>
> >
> >
>
>
> ------------------------------------------------------------------------
> TV dinner still cooling?
> Check out "Tonight's Picks"
> on
> Yahoo! TV.
>
>
> ------------------------------------------------------------------------
> It's here! Your new message!
> Get new email alerts
>
> with the free Yahoo! Toolbar.
>
---------------------------------
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.