[hibernate-issues] [JIRA] (HHH-13860) @Immutable entities generate warning even if they are not referenced in query

lukas.schmidt (JIRA) jira at hibernate.atlassian.net
Wed Feb 12 04:51:35 EST 2020


lukas.schmidt ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e42a782bbb5110c9a66931e ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 ) HHH-13860 ( https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 ) @Immutable entities generate warning even if they are not referenced in query ( https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.11 Assignee: Unassigned Components: hibernate-core Created: 12/Feb/2020 01:51 AM Environment: OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Ubuntu 18.04 LTS
PostgreSQL 10+190ubuntu0.1 Priority: Minor Reporter: lukas.schmidt ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e42a782bbb5110c9a66931e )

We get this warning when executing the reported query:

HHH000487: The query: [update PvDb r set r.externalId = :externalId where r.id = :id] attempts to update an immutable entity: [PV_DB]

We execute the following code (simplified):

           String hql = "update PvDb r set r.externalId = :externalId where r.id = :id" ;
           Session session = sessionFactory.openSession();
           Query query = session.createQuery(hql);
           query.setParameter( "externalId" , externalId);
           query.setParameter( "id" , id);
           int updateCount = query.executeUpdate();

These two classes are mapped to the table PV_DB:

@Table(name = "PV_DB" )
@Entity
public class PvDb extends PvDbCommon

@Table(name = "PV_DB" )
@Entity
@Immutable
public class PvDbTO extends PvDbCommon

@MappedSuperclass
public class PvDbCommon

In the executed query, an object instanceof PvDb is referenced, but no PvDbTO. Nevertheless the warning is shown. The update is executed successfully.

Expected result: The update is executed successfully, but no warning is shown.

( https://hibernate.atlassian.net/browse/HHH-13860#add-comment?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13860#add-comment?atlOrigin=eyJpIjoiOTVlN2E0NWE0ODZhNDIwYjhlNTE2OGVhOTNlNGU5YmQiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100119- sha1:c41815e )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200212/6b353198/attachment.html 


More information about the hibernate-issues mailing list