Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] java.lang.IllegalArgumentException

Hi Dmitry,

You must have a field in the OebsView table, say OEBSID. You can either map this field using a basic mapping, in which case the attribute type should be string, or as a relationship (OneToOne), in which case the attribute should be the referenced entity type. A relationship mapping cannot go on a string type or you will get this exception. I don't know how you have created the class, but you have to change the mapping or the attribute type for it to work as it is.
Best Regards,
Chris

dmitryerkin wrote:
Hi, Chris!
Thank you for your answer

You are perfectly right. The ejb3.OebsView class has the oebsId attribute
which is mapped as one to one to the ejb3.Oebskeyfields class. The type of
oebsId is String.
You mean I have to change the type of oebsId from String to ejb3.OebsView?
But these classes are generated by workbench so I can not understand your
tip.
Sorry.

Regards,
Dmitry



Christopher Delahunt wrote:
Hello Dmitry,

The problem isn't in the ejb3.Oebskeyfields, but in a oebsId mapping in the ejb3.OebsView class. I believe you have a OneToOne mapping to this attribute, and EclipseLink then has to try and put a Oebskeyfields object into a String - hence the exception.

Please check your mappings and attribute types in the Oebskeyfields entity and post them if this doesn't help.

Best Regards,
Chris

dmitryerkin wrote:
Hi
I have got the exception which is so strange for me.
Here is the log:

Exception Description: Trying to set value [ejb3.Oebskeyfields@ff00ff0]
for
instance variable [oebsId] of type [java.lang.String] in the object.  The
specified object is not an instance of the class or interface declaring
the
underlying field, or an unwrapping conversion has failed.
Internal Exception: java.lang.IllegalArgumentException
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[oebsId]
Descriptor: RelationalDescriptor(ejb3.OebsView -->
[DatabaseTable(OEBS_VIEW)])

The ejb3.Oebskeyfields has not got the oebsId attribute.
This is truth but my code is trying to get the instance of another class
ejb3.OebsView by invoking the next() method of cursor.
These classes are joined as one to one by the oebsId attribute.

Here is my code:

...
ReadAllQuery queryByTime = new ReadAllQuery(OebsView.class, where);
queryByTime.useScrollableCursor();
...
cursorByTimeAndOrganizationId = (ScrollableCursor)
uow.executeQuery(queryByTime);
...
Vector<ejb3.OebsView> oebsList = new Vector<ejb3.OebsView>();
oebsList = cursorByTimeAndOrganizationId.next(q);
...

I can not understand at all why does it try to set value of the
ejb3.Oebskeyfields class?


Regards
Dmitry



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users





Back to the top