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

Select all users in a group beside currentUser
java.lang.IllegalArgumentException: No query defined for that name [Offices.getAllOffices]
A strange phenomenon when use dozer in jpa project,why Mapping annotation in lazy load object can't work?
guice JpaPersistModule with runtime configuration
EclipseLink Avoid Collection Persist / Remove
JPA Criteria API causing missing right parenthesis error
JPA metamodel and #Convert on a List<String> attribute
JPQL Filtering child
JPA and contains
In Wildfly 8 or 9 in standalone.xml why is the JPA version 1.1?
olingo application with JPA Models based OData Services
Can't find persitence Unit with Arquillian
Oracle proxy authentication: Rollback of whole transaction
Entitymanager automatic update netbeans
how to use split in .setParameter like Jpql
Performance problems using a Spring Batch FieldSetMapper to map into an object that will be written with a JpaItemWriter?

Categories

HOME
android
algorithm
grok
gdb
polymer
jelastic
composite-primary-key
shiro
google-cloud-functions
regular-language
android-json
google-cloud-datalab
joomla3.0
fosrestbundle
project
g++
automatic-ref-counting
dynatrace
internationalization
atlassian-stash
jersey-1.0
pyramid
production
nodemcu
gmm
libigl
flask-sqlalchemy
monit
openmdao
autolisp
android-gridview
hard-drive
modalviewcontroller
baidu-map
roblox
python-pptx
ods
railstutorial.org
metaprogramming
p4merge
urlsession
magento-1.9.3
xmldocument
memory-mapping
rfc3339
jide
getchar
rserve
manova
singleinstance
page-replacement
arq
java-bytecode-asm
excel-dna
gets
myspace
neon
mongodb-php
mta
rspec2
cassia
cortex-m
invoke-sqlcmd
concurrentmodification
terracotta
themoviedb-api
lazybones
microsoft-reporting
text-search
pax-exam
jdk1.7
typemock
branch-and-bound
ansi
phpldapadmin
document-repository
boost-program-options
jbake
iiop
ghcjs
tinyxml
memset
scringo
actiondispatch
pyunit
listitem
isa-swizzling
rmdir
umra
inline-formset

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