1

I'm getting an ORA-12899 Error when updating Entities in the DB via EclipseLink. The Exception reads as follows:

RuntimeException caught: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.BatchUpdateException: ORA-12899: value too large for column "T_MONITORING"."VERSION" (actual: 295, maximum: 255)

Error Code: 12899 Query: UpdateObjectQuery(MonitoringBE@7e6dc6aeMonitoringBE {id: 17b50dcd-3184-4b47-998a-7c3a93a71695, hostname: HOSTNAME, releaseTimestamp: 2013-10-17 12:04:01.578, javaVersion: 1.6.0_24, softwareVersion: 4.0.30.SP401-RC8, testId: 6e1bc90f_549a_46aa_91f2_e9ff8a96baef, version: PSDZ:4.8.1.0332013 - 20130522-1210;KIS AWL:5.0.0;KIS-WB:[S15A;0;0;32;2;Mon Oct 07 15:03:55 CEST 2013;4556499;3;Ausleitung zu SAb;8;8], lastMrtAnswer: 2013-10-17 12:45:15.471, serverInstance: MyServer, lastModified: 2013-10-17 12:45:24.088})

The column "VERSION" is defined as VARCHAR2(255 CHAR). My problem in this case is that the String in the exception is not longer than 255 Chars. How can that be? Is the Exception's output wrong? The update query is not executed.

The BusinessEntity (MonitoringBE) is manipulated in plaind java using setter-methods. Then a merge is called in the entity manager (javax.persistence.EntityManager):

getEntityManager().merge( entity )

I'm using Oracle 11g Enterprise (11.2.0.2.0) with EclipseLink 2.1.1 from a Java 1.6.0.24 Glassfish Server. The character set in Oracle is AL32UTF8 which should be able to store all types of chars (4 Byte).

Can anyone help?

3
  • Is it possible that you print the value for the last modified entity, but that some previous modification in the same transaction is too long? Oct 23, 2013 at 11:06
  • Turn on eclipselink parameter logging to see what it issues to the db, see wiki.eclipse.org/EclipseLink/Examples/JPA/Logging. Also check that if using method access, your getter method isn't appending something to the string
    – Chris
    Oct 23, 2013 at 11:50
  • I'm also getting the feeling that the exception does not log the new values but some other entity is throwing the error. But that does not mean I'm any closer to finding the cause. The system is running in an production environment, so changing the eclipse logging on that machine is not possible. I will try to reproduce the error locally.
    – czo02
    Oct 24, 2013 at 5:46

2 Answers 2

0

as mentioned in error "actual: 295"

Which mean database layer getting 295 character for the column, please make sure that query syntax and double quotes, comma etc in correct place

1
  • The Exception is thrown at the end of the transaction which is controlled by a Spring-AOP Pointcut. The DB-Queries are made by EclipseLink, so I only can guess what they really are. The BE class is annotated: @Entity @Table(name = "T_MONITORING") public class MonitoringBE { ` @Column(name = "VERSION")` ` private String version;`
    – czo02
    Oct 24, 2013 at 5:53
0

I could reproduce the behavior with a newer Eclipselink version 2.5.1. The exception there states the correct parameter value for the attribute. Maybe EclipseLink 2.1.1 has different behavior here. Truncating the String before setting it in the Entity solves the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.