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

Why can't I catch this EJBTransactionRolledbackException
JPA entity graph: all properties except one
How can I filter entities while querying based on non-persistent condition?
JPA count distinct multiple expressions
Validator.validate() return null
JPA transaction-type, non-jta-data-source and jta-data-source
JPA ManyToOne Relationship: foreign key not being stored in table of many side
Olingo OData V2 Read Property not implemented
Customizing entity handled by JPA repository
JPA Query with GROUP BY, HAVING and COUNT
Load data from two OneToMany relationships
How can i get entity object with contion JPA
How to set DB2 global variable on session from spring data jpa context
How to detect if a field will lazyload?
QuerySyntaxException: expecting IDENT, found ''Android'' near line 1
Bi directional OneToOne does not refresh

Categories

HOME
azure-stream-analytics
spark-streaming
ggplot2
nvd3.js
android-studio-2.2
nunit
mjml
angular2-material
fftw
mstest
solver
error-handling
knitr
alarm
jetty
jax-ws
teechart
categorical-data
siddhi
spring-social
selenium-ide
symbol
modbus-tcp
mvc-mini-profiler
html5-appcache
react-toolbox
ios10.2
string-concatenation
direct3d11
google-cloud-print
opentk
jasmine-node
delimiter
intersystems-cache
comparable
mql
nsurl
send
quickfixj
jett
arduino-ide
dcmtk
plr
file-sharing
signal-strength
show-hide
getchar
xbmc
opennms
user-defined-fields
activeperl
singleinstance
custom-font
context-sensitive-grammar
subnet
truezip
android-testing
jqchart
cup
objectscript
sandcastle
vcloud-director-rest-api
smartfoxserver
webjars
burrows-wheeler-transform
spreadjs
redis-cluster
pushbots
exim4
crouton-os
jdi
morton-number
cgi-bin
typemock
branch-and-bound
shopizer
rapidsvn
packet-sniffers
post-commit-hook
paw
verold
maven-scm
jammer
gpars
mvc-editor-templates
asdf
kaleidoscope
scmmanager
actiondispatch
onload-event
insert-id
chart-director
uimanageddocument
paginator
objectquery
htdocs
android-holo-everywhere
creole
quotation-marks
cuteeditor
non-clustered-index
dot-emacs
ajax-polling
zend-rest
nstokenfield
pagemethods
sifr3
appliance

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