Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » executeUpdate failed with EclipseLink-4002 / ORA-00936 (Sometime executeUpdate don't set attribut update value correctly)
executeUpdate failed with EclipseLink-4002 / ORA-00936 [message #1803616] Tue, 05 March 2019 14:31
Jean-Claude Souvignet is currently offline Jean-Claude SouvignetFriend
Messages: 1
Registered: March 2019
Junior Member
Considere Employee entity with lastName, codePostal and ID attribut.
I want update lastName with executeUpdate fonction :

CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaUpdate<Employee> update = cb.createCriteriaUpdate(Employee.class);
Root<Employee> root = update.from(Employee.class);
Path<String> lastName = root.get("lastName");
Path<Long> id = root.get("id");

update.set(lastName,  cb.concat( cb.literal("updated - ") , id.as(String.class)));

update.where(cb.equal(root.get("codePostal"), "32730"));
Query query = em.createQuery(update);
int rowCount = query.executeUpdate();


This code failed with this output :
Error Code: 936
Call: UPDATE EMPLOYEE SET LASTNAME = CONCAT(?, ) WHERE (CODEPOSTAL = ?)
	bind => [updated - , 32730]
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:161)
	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
	... 9 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00936: expression absente


Replacing attribut order
update.set(lastName, cb.concat( cb.literal("updated - ") , id.as(String.class)));
by
update.set(lastName, cb.concat( id.as(String.class), cb.literal(" - updated")));

Execution is succefull, output is
[EL Fine]: sql: 2019-03-05 15:22:28.717--ClientSession(1583992583)--Connection(112026691)--Thread(Thread[main,5,main])--UPDATE EMPLOYEE SET LASTNAME = CONCAT(ID, ?) WHERE (CODEPOSTAL = ?)
	bind => [ - updated, 32730]


It seems that in the fist case ID attribut is not set in request.
Does this situation is known ? Something I forget ?
Previous Topic:ExpressionBuilder left outer join with on clause
Next Topic:Exception ResultSet using eclipseLink @NamedStoredProcedureQuery
Goto Forum:
  


Current Time: Sat Aug 24 07:29:12 GMT 2019

Powered by FUDForum. Page generated in 0.01888 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top