jpa


What is this Eclipselink error and how to solve it?


Here is the relevant stacktrace:
[EL Warning]: 2017-05-11 16:35:34.18--ServerSession(4115088)--Exception [EclipseLink-32] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Trying to set value [0] for instance variable [EmpInd] of type [char] 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: Can not set char field com.MyProj.entity.EmployeeTask.empInd to java.lang.Integer
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[EmpInd-->EMPLOYEE_TASK.EMP_IND]
Descriptor: RelationalDescriptor(com.MyProj.entity.EmployeeTask --> [DatabaseTable(EMPLOYEE_TASK)])
at org.eclipse.persistence.exceptions.DescriptorException.illegalArgumentWhileSettingValueThruInstanceVariableAccessor(DescriptorException.java:682)
at org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.setAttributeValueInObject(InstanceVariableAttributeAccessor.java:184)
at org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1368)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1259)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:332)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:661)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:494)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:444)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:441)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:399)
at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2322)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolicy.java:299)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal(ForeignReferenceMapping.java:1624)
at org.eclipse.persistence.mappings.OneToOneMapping.valueFromRowInternal(OneToOneMapping.java:1563)
at org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java:1534)
at org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1258)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:332)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:661)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:583)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:552)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:492)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:444)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:838)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:464)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2898)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:453)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:681)
The key is this phrase:
Can not set char field com.MyProj.entity.EmployeeTask.empInd to java.lang.Integer Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[EmpInd-->EMPLOYEE_TASK.EMP_IND] Descriptor: RelationalDescriptor(com.MyProj.entity.EmployeeTask --> [DatabaseTable(EMPLOYEE_TASK)])
The database field EMPLOYEE_TASK.EMP_IND is an integer while the Java field com.MyProj.entity.EmployeeTask.empInd is a char. EclipseLink is unable to convert the integer returned from the database into a char so it can be set in your EmployeeTask object.

Related Links

how could i use JPA criteria query api for joined columns?
How can I get constraints working in grails if I'm using JPA annotated classes from a jar file?
Why does JPA do a double insert upon merge()
Construct JPA query for a OneToMany relation
How to persist JPA entities even when EJB method throws an exception?
Ignoring some elements/classes in JAXB binding
JPA Native Query
JPQL “NOT MEMBER OF” query using criteria API
Java EE, casting Entity to Extended one!
JPA named queries
Generate DDL for JPA 2.0 with EclipseLink
JPQL Query using max on a date field
How to config depth of cascade operation in EclipseLink?
Java EE, EntitiManager Query, SELECT JOINED entities
JPA - Is there a way/method to retrieve Persistence Unit information
Seam - how to deatach entity

Categories

HOME
cygwin
api
wakanda
newrelic
nsbundle
aws-cli
google-apps
emscripten
telegram-bot
python-multithreading
accessibility
mql5
categorical-data
vimdiff
distribution
filechannel
automatic-ref-counting
supervisor
do-while
firefox-addon
google-container-registry
connector
database-connection
symbols
question2answer
event-store
gmock
licensing
jasmine-node
nstimer
underscore.js
handler
bioinformatics
iis-express
mql
finagle
record
kodi
playstation-portable
mailkit
pdw-file-browser
xdocreport
connection-pool
escpos
linqpad
memory-mapping
procfile
puredata
magic-draw
azure-cli
skin
reshape
restore
reporting-services-2012
burrows-wheeler-transform
signalr.client
mongodb-php
jboss-tools
realsense
dynatree
qt5.2
jdi
django-urls
visual-sourcesafe-2005
sql-server-data-tools
pyobjc
nsurlsessiondatatask
encryption-asymmetric
twitter-bootstrap-rails
hibernate-entitymanager
kendo-dataviz
code-duplication
modular
rolify
merb
route-provider
time.h
css-reset
font-awesome-4.0.0
superscrollorama
cardreader
preload
pdfviewer
qi4j
patricia-trie
pstack
virtualpathprovider
u2netdk
uipagecontrol
massive
qglwidget
ie-compatibility-mode

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App